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;
...@@ -146,4 +146,13 @@ public class CylinderInfoDto extends BaseDto { ...@@ -146,4 +146,13 @@ public class CylinderInfoDto extends BaseDto {
*/ */
private String inspectionStatusDesc; private String inspectionStatusDesc;
private int isWarn = 0;
private String qrCode;
private String electronicLabelCode;
private String cylinderStatusStr;
} }
...@@ -104,4 +104,7 @@ public class CylinderUnitDto extends BaseDto { ...@@ -104,4 +104,7 @@ 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;
......
...@@ -24,6 +24,9 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> { ...@@ -24,6 +24,9 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> {
*/ */
Map<String, String> queryNumAndOutOfDateNum(@Param("sequenceNbr") Long sequenceNbr); Map<String, String> queryNumAndOutOfDateNum(@Param("sequenceNbr") Long sequenceNbr);
Integer getMonthInfoTotal(@Param("regionCode") String regionCode);
/** /**
* 获取上个月气瓶总量 * 获取上个月气瓶总量
* @return * @return
...@@ -47,6 +50,8 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> { ...@@ -47,6 +50,8 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> {
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;
/** /**
...@@ -11,4 +13,6 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInspection; ...@@ -11,4 +13,6 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInspection;
*/ */
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>
......
...@@ -22,6 +22,11 @@ ...@@ -22,6 +22,11 @@
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' ) ,
date_format( sync_date, '%Y%m' ) ) =1 AND app_id in (<include refid="selectAPPIdByRegionCode"/>) date_format( sync_date, '%Y%m' ) ) =1 AND app_id in (<include refid="selectAPPIdByRegionCode"/>)
...@@ -44,6 +49,10 @@ ...@@ -44,6 +49,10 @@
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>
...@@ -20,4 +20,8 @@ ...@@ -20,4 +20,8 @@
) )
</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;
...@@ -44,7 +54,6 @@ public class EquipmentCategoryController extends BaseController { ...@@ -44,7 +54,6 @@ public class EquipmentCategoryController extends BaseController {
return ResponseHelper.buildResponse(model); return ResponseHelper.buildResponse(model);
} }
/** /**
* 根据sequenceNbr删除 * 根据sequenceNbr删除
* *
...@@ -54,7 +63,8 @@ public class EquipmentCategoryController extends BaseController { ...@@ -54,7 +63,8 @@ public class EquipmentCategoryController extends BaseController {
@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,
@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(equipmentCategoryServiceImpl.removeById(sequenceNbr)); return ResponseHelper.buildResponse(equipmentCategoryServiceImpl.removeById(sequenceNbr));
} }
...@@ -66,7 +76,7 @@ public class EquipmentCategoryController extends BaseController { ...@@ -66,7 +76,7 @@ public class EquipmentCategoryController extends BaseController {
*/ */
@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));
} }
...@@ -80,9 +90,9 @@ public class EquipmentCategoryController extends BaseController { ...@@ -80,9 +90,9 @@ public class EquipmentCategoryController extends BaseController {
*/ */
@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);
...@@ -95,9 +105,33 @@ public class EquipmentCategoryController extends BaseController { ...@@ -95,9 +105,33 @@ public class EquipmentCategoryController extends BaseController {
* @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);
}
} }
...@@ -124,38 +124,38 @@ public class WechatController extends BaseController { ...@@ -124,38 +124,38 @@ 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) {
...@@ -163,23 +163,23 @@ public class WechatController extends BaseController { ...@@ -163,23 +163,23 @@ public class WechatController extends BaseController {
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
*/ */
...@@ -292,8 +292,8 @@ public class WechatController extends BaseController { ...@@ -292,8 +292,8 @@ public class WechatController extends BaseController {
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,7 +336,7 @@ public class WechatController extends BaseController { ...@@ -337,7 +336,7 @@ 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);
...@@ -353,7 +352,7 @@ public class WechatController extends BaseController { ...@@ -353,7 +352,7 @@ 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);
...@@ -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 phone,
@ApiParam(value = "任务类别", required = true) @RequestParam String taskType, @ApiParam(value = "任务类别", required = true) @RequestParam String taskType,
@ApiParam(value = "当前页码", required = true) @RequestParam Long currentPage) { @ApiParam(value = "当前页码", required = true) @RequestParam Long currentPage) {
if (ValidationUtil.isEmpty(phone) || if (ValidationUtil.isEmpty(phone) || ValidationUtil.isEmpty(taskType) || ValidationUtil.isEmpty(currentPage)) {
ValidationUtil.isEmpty(taskType) ||
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 phone,
@ApiParam(value = "业务类别", required = true) @RequestParam String businessType, @ApiParam(value = "业务类别", required = true) @RequestParam String businessType,
@ApiParam(value = "当前页码", required = true) @RequestParam Long currentPage) { @ApiParam(value = "当前页码", required = true) @RequestParam Long currentPage) {
if (ValidationUtil.isEmpty(phone) || if (ValidationUtil.isEmpty(phone) || ValidationUtil.isEmpty(businessType)
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,7 +531,7 @@ public class WechatController extends BaseController { ...@@ -525,7 +531,7 @@ 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);
...@@ -542,27 +548,27 @@ public class WechatController extends BaseController { ...@@ -542,27 +548,27 @@ 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())) { } else if ("die_num".equals(t.getFieldCode())) {
// 死亡人数 // 死亡人数
if(StringUtils.isNotEmpty(value)) { if (StringUtils.isNotEmpty(value)) {
temp.setHasDeadHurt("有"); temp.setHasDeadHurt("有");
} }
} }
...@@ -573,47 +579,45 @@ public class WechatController extends BaseController { ...@@ -573,47 +579,45 @@ public class WechatController extends BaseController {
paperList = iAlertFormValueService.list(queryWrapper); paperList = iAlertFormValueService.list(queryWrapper);
paperList.stream().forEach(t -> { paperList.stream().forEach(t -> {
String value = t.getFieldValue(); String value = t.getFieldValue();
if("error_result".equals(t.getFieldCode())) { if ("error_result".equals(t.getFieldCode())) {
// 故障原因 // 故障原因
temp.setErrorResult(value); temp.setErrorResult(value);
} else if("fix_result".equals(t.getFieldCode())) { } else if ("fix_result".equals(t.getFieldCode())) {
// 维修结果 // 维修结果
temp.setFixResult(value); temp.setFixResult(value);
} else if("fix_remark".equals(t.getFieldCode())) { } else if ("fix_remark".equals(t.getFieldCode())) {
// 维修备注 // 维修备注
temp.setRemark(value); temp.setRemark(value);
} }
}); });
imgMap = sourceFileService.getAttachments(temp.getPaperId()); imgMap = sourceFileService.getAttachments(temp.getPaperId());
imgDtos = imgMap.get("imgs"); imgDtos = imgMap.get("imgs");
temp.setFixImgs(imgDtos); temp.setFixImgs(imgDtos);
break; break;
case "961" : // 故障维修 case "961": // 故障维修
queryWrapper = new LambdaQueryWrapper<>(); queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AlertFormValue::getAlertCalledId, temp.getPaperId()); queryWrapper.eq(AlertFormValue::getAlertCalledId, temp.getPaperId());
// 派遣动态表单 // 派遣动态表单
paperList = iAlertFormValueService.list(queryWrapper); paperList = iAlertFormValueService.list(queryWrapper);
paperList.stream().forEach(t -> { paperList.stream().forEach(t -> {
String value = t.getFieldValue(); String value = t.getFieldValue();
if("error_result".equals(t.getFieldCode())) { if ("error_result".equals(t.getFieldCode())) {
// 故障原因 // 故障原因
temp.setErrorResult(value); temp.setErrorResult(value);
} else if("fix_result".equals(t.getFieldCode())) { } else if ("fix_result".equals(t.getFieldCode())) {
// 维修结果 // 维修结果
temp.setFixResult(value); temp.setFixResult(value);
} else if("fix_remark".equals(t.getFieldCode())) { } else if ("fix_remark".equals(t.getFieldCode())) {
// 维修备注 // 维修备注
temp.setRemark(value); temp.setRemark(value);
} else if("feedback_result".equals(t.getFieldCode())) { } else if ("feedback_result".equals(t.getFieldCode())) {
// 反馈结果 // 反馈结果
temp.setFeedbackResult(value); temp.setFeedbackResult(value);
} }
}); });
imgMap = sourceFileService.getAttachments(temp.getPaperId()); imgMap = sourceFileService.getAttachments(temp.getPaperId());
imgDtos = imgMap.get("imgs"); imgDtos = imgMap.get("imgs");
temp.setFixImgs(imgDtos); temp.setFixImgs(imgDtos);
...@@ -623,20 +627,20 @@ public class WechatController extends BaseController { ...@@ -623,20 +627,20 @@ public class WechatController extends BaseController {
feedbackDtos = errorImgMap.get("feedbacks"); feedbackDtos = errorImgMap.get("feedbacks");
temp.setFeedBackImgs(feedbackDtos); temp.setFeedBackImgs(feedbackDtos);
break; break;
case "962" : // 投诉建议 case "962": // 投诉建议
queryWrapper = new LambdaQueryWrapper<>(); queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AlertFormValue::getAlertCalledId, temp.getPaperId()); queryWrapper.eq(AlertFormValue::getAlertCalledId, temp.getPaperId());
// 派遣动态表单 // 派遣动态表单
paperList = iAlertFormValueService.list(queryWrapper); paperList = iAlertFormValueService.list(queryWrapper);
paperList.stream().forEach(t -> { paperList.stream().forEach(t -> {
String value = t.getFieldValue(); String value = t.getFieldValue();
if("action_result".equals(t.getFieldCode())) { if ("action_result".equals(t.getFieldCode())) {
// 处置结果 // 处置结果
temp.setActionResult(value); temp.setActionResult(value);
} else if("main_feedback_result".equals(t.getFieldCode())) { } else if ("main_feedback_result".equals(t.getFieldCode())) {
// 维修结果 // 维修结果
temp.setRemark(value); temp.setRemark(value);
} else if("feedback_result".equals(t.getFieldCode())) { } else if ("feedback_result".equals(t.getFieldCode())) {
// 维修结果 // 维修结果
temp.setFeedbackResult(value); temp.setFeedbackResult(value);
} }
...@@ -662,13 +666,14 @@ public class WechatController extends BaseController { ...@@ -662,13 +666,14 @@ public class WechatController extends BaseController {
@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) {
if (ValidationUtil.isEmpty(file)) {
throw new BadRequest("参数校验失败."); throw new BadRequest("参数校验失败.");
} }
String accessToken = wechatService.getAccessToken(); String accessToken = wechatService.getAccessToken();
String getPicUrl = "https://api.weixin.qq.com/cgi-bin/media/upload?access_token=" + accessToken + "&type=image"; String getPicUrl = "https://api.weixin.qq.com/cgi-bin/media/upload?access_token=" + accessToken + "&type=image";
String url = HttpUtils.doPostWithFile(getPicUrl,file,"media",accessToken,"image"); String url = HttpUtils.doPostWithFile(getPicUrl, file, "media", accessToken, "image");
return ResponseHelper.buildResponse(url); return ResponseHelper.buildResponse(url);
} }
......
...@@ -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);
} }
...@@ -304,8 +316,8 @@ public class TzsJgServiceImpl implements ITzsJgService { ...@@ -304,8 +316,8 @@ public class TzsJgServiceImpl implements ITzsJgService {
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);
} }
} }
......
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;
/** /**
* 气瓶基本信息 * 气瓶基本信息
...@@ -69,6 +76,9 @@ public class CylinderInfoController extends BaseController { ...@@ -69,6 +76,9 @@ public class CylinderInfoController extends BaseController {
CylinderUnitServiceImpl cylinderUnitServiceImpl; CylinderUnitServiceImpl cylinderUnitServiceImpl;
@Autowired @Autowired
CylinderInspectionServiceImpl cylinderInspectionServiceImpl;
@Autowired
CylinderFillingRecordServiceImpl cylinderFillingRecordServiceImpl; CylinderFillingRecordServiceImpl cylinderFillingRecordServiceImpl;
@Autowired @Autowired
...@@ -79,6 +89,12 @@ public class CylinderInfoController extends BaseController { ...@@ -79,6 +89,12 @@ public class CylinderInfoController extends BaseController {
@Autowired @Autowired
private SourceFileServiceImpl sourceFileService; private SourceFileServiceImpl sourceFileService;
@Autowired
DataDictionaryServiceImpl iDataDictionaryService;
@Autowired
CylinderTagsServiceImpl cylinderTagsServiceImpl;
/** /**
* 新增气瓶基本信息 * 新增气瓶基本信息
* *
...@@ -101,7 +117,8 @@ public class CylinderInfoController extends BaseController { ...@@ -101,7 +117,8 @@ public class CylinderInfoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}") @PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新气瓶基本信息", notes = "根据sequenceNbr更新气瓶基本信息") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新气瓶基本信息", notes = "根据sequenceNbr更新气瓶基本信息")
public ResponseModel<CylinderInfoDto> updateBySequenceNbrCylinderInfo(@RequestBody CylinderInfoDto model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<CylinderInfoDto> updateBySequenceNbrCylinderInfo(@RequestBody CylinderInfoDto model,
@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr); model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(cylinderInfoServiceImpl.updateWithModel(model)); return ResponseHelper.buildResponse(cylinderInfoServiceImpl.updateWithModel(model));
} }
...@@ -114,7 +131,8 @@ public class CylinderInfoController extends BaseController { ...@@ -114,7 +131,8 @@ public class CylinderInfoController extends BaseController {
@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,
@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(cylinderInfoServiceImpl.removeById(sequenceNbr)); return ResponseHelper.buildResponse(cylinderInfoServiceImpl.removeById(sequenceNbr));
} }
...@@ -141,8 +159,8 @@ public class CylinderInfoController extends BaseController { ...@@ -141,8 +159,8 @@ public class CylinderInfoController extends BaseController {
@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<CylinderInfoDto>> queryForPage(@RequestParam(value = "current") int current, @RequestParam public ResponseModel<Page<CylinderInfoDto>> queryForPage(@RequestParam(value = "current") int current,
(value = "size") int size) { @RequestParam(value = "size") int size) {
Page<CylinderInfoDto> page = new Page<CylinderInfoDto>(); Page<CylinderInfoDto> page = new Page<CylinderInfoDto>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
...@@ -161,7 +179,6 @@ public class CylinderInfoController extends BaseController { ...@@ -161,7 +179,6 @@ public class CylinderInfoController extends BaseController {
return ResponseHelper.buildResponse(cylinderInfoServiceImpl.queryForCylinderInfoList()); return ResponseHelper.buildResponse(cylinderInfoServiceImpl.queryForCylinderInfoList());
} }
// /** // /**
// * 获取气瓶增加减少总量及环比 // * 获取气瓶增加减少总量及环比
// * // *
...@@ -238,7 +255,6 @@ public class CylinderInfoController extends BaseController { ...@@ -238,7 +255,6 @@ public class CylinderInfoController extends BaseController {
return ResponseHelper.buildResponse(true); return ResponseHelper.buildResponse(true);
} }
// // 数据完整性计算 气瓶企业信息 气瓶基本信息 标签 检验 充装 充装审核 // // 数据完整性计算 气瓶企业信息 气瓶基本信息 标签 检验 充装 充装审核
// /** // /**
// * 数据完整性计算 // * 数据完整性计算
...@@ -401,7 +417,6 @@ public class CylinderInfoController extends BaseController { ...@@ -401,7 +417,6 @@ public class CylinderInfoController extends BaseController {
return ResponseHelper.buildResponse(true); return ResponseHelper.buildResponse(true);
} }
/** /**
* 装卸液体数据同步 * 装卸液体数据同步
* *
...@@ -425,7 +440,9 @@ public class CylinderInfoController extends BaseController { ...@@ -425,7 +440,9 @@ public class CylinderInfoController extends BaseController {
@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(@RequestParam(value = "pageNum") int pageNum, @RequestParam(value = "pageSize") int pageSize, String sort, CylinderFillingRecordDto cylinderFillingRecordDto) { public ResponseModel<IPage<CylinderFillingRecordDto>> cyinderRecordList(
@RequestParam(value = "pageNum") int pageNum, @RequestParam(value = "pageSize") int pageSize, String sort,
CylinderFillingRecordDto cylinderFillingRecordDto) {
Page<CylinderFillingRecordDto> page = new Page<>(); Page<CylinderFillingRecordDto> page = new Page<>();
page.setCurrent(pageNum); page.setCurrent(pageNum);
page.setSize(pageSize); page.setSize(pageSize);
...@@ -447,7 +464,8 @@ public class CylinderInfoController extends BaseController { ...@@ -447,7 +464,8 @@ public class CylinderInfoController extends BaseController {
if (StringUtils.isEmpty(cylinderFillingRecordDto.getSequenceCode())) { if (StringUtils.isEmpty(cylinderFillingRecordDto.getSequenceCode())) {
cylinderFillingRecordDto.setAppId("9B150BB7D0C21A7A62BD6837E14A44BF"); cylinderFillingRecordDto.setAppId("9B150BB7D0C21A7A62BD6837E14A44BF");
} }
Page<CylinderFillingRecordDto> pageBean = cylinderFillingRecordServiceImpl.queryListByQueryDto(page, cylinderFillingRecordDto, sortParam, sortRule); Page<CylinderFillingRecordDto> pageBean = cylinderFillingRecordServiceImpl.queryListByQueryDto(page,
cylinderFillingRecordDto, sortParam, sortRule);
Page<CylinderFillingRecordDto> result = new Page<>(pageNum, pageSize); Page<CylinderFillingRecordDto> result = new Page<>(pageNum, pageSize);
long totle = pageBean.getTotal(); long totle = pageBean.getTotal();
result.setRecords(pageBean.getRecords()); result.setRecords(pageBean.getRecords());
...@@ -455,7 +473,6 @@ public class CylinderInfoController extends BaseController { ...@@ -455,7 +473,6 @@ public class CylinderInfoController extends BaseController {
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
/** /**
* 气瓶基本信息 * 气瓶基本信息
* *
...@@ -466,11 +483,13 @@ public class CylinderInfoController extends BaseController { ...@@ -466,11 +483,13 @@ public class CylinderInfoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/cyinderInfoList") @GetMapping(value = "/cyinderInfoList")
@ApiOperation(httpMethod = "GET", value = "获取登陆人所在气瓶基本信息", notes = "获取登陆人所在气瓶基本信息") @ApiOperation(httpMethod = "GET", value = "获取登陆人所在气瓶基本信息", notes = "获取登陆人所在气瓶基本信息")
public ResponseModel<IPage<CylinderInfoDto>> cyinderInfoList(@RequestParam(value = "pageNum") String pageNum, @RequestParam(value = "pageSize") String pageSize, String sort, CylinderInfoDto cylinderInfoDto) { public ResponseModel<IPage<CylinderInfoDto>> cyinderInfoList(@RequestParam(value = "pageNum") String pageNum,
@RequestParam(value = "pageSize") String pageSize, String sort, CylinderInfoDto cylinderInfoDto) {
QueryWrapper<CylinderInfo> cylinderInfoQueryWrapper = new QueryWrapper<>(); QueryWrapper<CylinderInfo> cylinderInfoQueryWrapper = new QueryWrapper<>();
if (StringUtils.isNotEmpty(cylinderInfoDto.getRegionCode())) { if (StringUtils.isNotEmpty(cylinderInfoDto.getRegionCode())) {
List<String> appids = new ArrayList<>(); List<String> appids = new ArrayList<>();
List<CylinderUnit> unitList = cylinderUnitServiceImpl.list(new LambdaQueryWrapper<CylinderUnit>().like(CylinderUnit::getRegionCode, cylinderInfoDto.getRegionCode())); List<CylinderUnit> unitList = cylinderUnitServiceImpl.list(new LambdaQueryWrapper<CylinderUnit>()
.like(CylinderUnit::getRegionCode, cylinderInfoDto.getRegionCode()));
unitList.forEach(u -> { unitList.forEach(u -> {
appids.add(u.getAppId()); appids.add(u.getAppId());
}); });
...@@ -486,14 +505,36 @@ public class CylinderInfoController extends BaseController { ...@@ -486,14 +505,36 @@ public class CylinderInfoController extends BaseController {
} else { } else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize)); pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
} }
IPage<CylinderInfo> page = cylinderInfoServiceImpl.page(pageBean, cylinderInfoQueryWrapper); IPage<CylinderInfo> page;
int num = cylinderInfoServiceImpl.count(cylinderInfoQueryWrapper); if (cylinderInfoDto.getIsWarn() == 0) {
pageBean.setTotal(num); page = cylinderInfoServiceImpl.page(pageBean, cylinderInfoQueryWrapper);
} else {
page = cylinderInspectionServiceImpl.queryOutOfDateCylinder(pageBean, cylinderInfoDto.getAppId());
}
// int num = cylinderInfoServiceImpl.count(cylinderInfoQueryWrapper);
// pageBean.setTotal(num);
IPage<CylinderInfoDto> result = BeanDtoVoUtils.cyinderInfoIPageDto(page); IPage<CylinderInfoDto> result = BeanDtoVoUtils.cyinderInfoIPageDto(page);
result.getRecords().forEach(i -> {
DataDictionary fillingMedia = iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>()
.eq(DataDictionary::getCode, i.getFillingMedia()).eq(DataDictionary::getType, "CZJZMC"));
i.setFillingMediaName(fillingMedia != null ? fillingMedia.getName() : null);
DataDictionary cylinderVariety = iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>()
.eq(DataDictionary::getSequenceNbr, i.getCylinderVariety()));
i.setCylinderVarietyName(cylinderVariety != null ? cylinderVariety.getName() : null);
DataDictionary cylinderStatus = iDataDictionaryService.getOne(
new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getSequenceNbr, i.getCylinderStatus()));
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); return ResponseHelper.buildResponse(result);
} }
private QueryWrapper<CylinderInfo> setQueryWrapper(QueryWrapper<CylinderInfo> queryWrapper, CylinderInfoDto cylinderInfo, String sort) { private QueryWrapper<CylinderInfo> setQueryWrapper(QueryWrapper<CylinderInfo> queryWrapper,
CylinderInfoDto cylinderInfo, String sort) {
if (cylinderInfo.getAppIds() != null && cylinderInfo.getAppIds().size() > 0) { if (cylinderInfo.getAppIds() != null && cylinderInfo.getAppIds().size() > 0) {
queryWrapper.in("app_id", cylinderInfo.getAppIds()); queryWrapper.in("app_id", cylinderInfo.getAppIds());
} }
...@@ -546,7 +587,6 @@ public class CylinderInfoController extends BaseController { ...@@ -546,7 +587,6 @@ public class CylinderInfoController extends BaseController {
return queryWrapper; return queryWrapper;
} }
/** /**
* 获取气瓶详细信息 * 获取气瓶详细信息
* *
...@@ -602,7 +642,6 @@ public class CylinderInfoController extends BaseController { ...@@ -602,7 +642,6 @@ public class CylinderInfoController extends BaseController {
return ResponseHelper.buildResponse(target); return ResponseHelper.buildResponse(target);
} }
/** /**
* 获取登陆人所在气瓶充装单位信息 * 获取登陆人所在气瓶充装单位信息
* *
...@@ -613,7 +652,8 @@ public class CylinderInfoController extends BaseController { ...@@ -613,7 +652,8 @@ public class CylinderInfoController extends BaseController {
@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, @RequestParam(value = "pageSize") String pageSize, String sort, CylinderUnitDto cylinderUnitDto) { public ResponseModel<IPage<CylinderUnitDto>> cyinderUnitList(@RequestParam(value = "pageNum") String pageNum,
@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<>();
...@@ -631,7 +671,6 @@ public class CylinderInfoController extends BaseController { ...@@ -631,7 +671,6 @@ public class CylinderInfoController extends BaseController {
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
/** /**
* 获取气瓶充装单位详情 * 获取气瓶充装单位详情
* *
...@@ -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) {
...@@ -684,8 +727,8 @@ public class CylinderInfoController extends BaseController { ...@@ -684,8 +727,8 @@ public class CylinderInfoController extends BaseController {
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")) {
...@@ -747,7 +790,6 @@ public class CylinderInfoController extends BaseController { ...@@ -747,7 +790,6 @@ public class CylinderInfoController extends BaseController {
}); });
} }
return page.convert(item -> { return page.convert(item -> {
try { try {
CylinderUnitDto target = new CylinderUnitDto(); CylinderUnitDto target = new CylinderUnitDto();
...@@ -769,7 +811,8 @@ public class CylinderInfoController extends BaseController { ...@@ -769,7 +811,8 @@ 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
.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, target.getAppId())));
return target; return target;
} catch (Exception e) { } catch (Exception e) {
return null; return null;
...@@ -786,7 +829,6 @@ public class CylinderInfoController extends BaseController { ...@@ -786,7 +829,6 @@ public class CylinderInfoController extends BaseController {
} }
} }
/** /**
* 企业气瓶总量数据同步 * 企业气瓶总量数据同步
* *
...@@ -866,44 +908,43 @@ public class CylinderInfoController extends BaseController { ...@@ -866,44 +908,43 @@ public class CylinderInfoController extends BaseController {
} }
@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));
} }
...@@ -937,15 +978,42 @@ public class CylinderInfoController extends BaseController { ...@@ -937,15 +978,42 @@ public class CylinderInfoController extends BaseController {
} }
} }
@Autowired @Autowired
private ScheduleService scheduleService; private ScheduleService scheduleService;
@TycloudOperation(ApiLevel = UserType.AGENCY , needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "气瓶/设备/许可预警测试接口(实际应为定时任务)") @ApiOperation(httpMethod = "GET", value = "气瓶/设备/许可预警测试接口(实际应为定时任务)")
@GetMapping(value = "/test") @GetMapping(value = "/test")
public void test(){ public void test() {
scheduleService.calEarlyWarningLevel(); 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;
...@@ -50,18 +51,20 @@ public class CylinderUnitController extends BaseController { ...@@ -50,18 +51,20 @@ 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);
...@@ -75,20 +78,23 @@ public class CylinderUnitController extends BaseController { ...@@ -75,20 +78,23 @@ public class CylinderUnitController extends BaseController {
*/ */
@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")));
} }
} }
...@@ -104,14 +110,13 @@ public class CylinderUnitController extends BaseController { ...@@ -104,14 +110,13 @@ public class CylinderUnitController extends BaseController {
*/ */
@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,8 +75,8 @@ import lombok.extern.slf4j.Slf4j; ...@@ -75,8 +75,8 @@ 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 @Autowired
CylinderUnitServiceImpl cylinderUnitServiceImpl; CylinderUnitServiceImpl cylinderUnitServiceImpl;
...@@ -169,6 +169,13 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -169,6 +169,13 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
/** /**
* 获取上个月气瓶总量 * 获取上个月气瓶总量
*/ */
public Integer getMonthInfoTotal(String regionCode) {
return baseMapper.getMonthInfoTotal(regionCode);
}
/**
* 获取上个月气瓶总量
*/
public Integer getLastMonthInfoTotal(String regionCode) { public Integer getLastMonthInfoTotal(String regionCode) {
return baseMapper.getLastMonthInfoTotal(regionCode); return baseMapper.getLastMonthInfoTotal(regionCode);
} }
...@@ -205,7 +212,8 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -205,7 +212,8 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
for (int i = 0; i < 30; i++) { for (int i = 0; i < 30; i++) {
now.add(Calendar.DATE, -1); now.add(Calendar.DATE, -1);
CylinderFillingUnloadDataDto temp = new CylinderFillingUnloadDataDto(); CylinderFillingUnloadDataDto temp = new CylinderFillingUnloadDataDto();
Double fillingSum = cylinderFillingRecordServiceImpl.getFillingSum(String.valueOf(regionModel.getRegionCode()), now.getTime()); Double fillingSum = cylinderFillingRecordServiceImpl
.getFillingSum(String.valueOf(regionModel.getRegionCode()), now.getTime());
Double unloadSum = 0d; Double unloadSum = 0d;
temp.setFillingSum(fillingSum); temp.setFillingSum(fillingSum);
temp.setRegionCode(String.valueOf(regionModel.getRegionCode())); temp.setRegionCode(String.valueOf(regionModel.getRegionCode()));
...@@ -259,33 +267,36 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -259,33 +267,36 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
System.out.println("====================数据完整性开始============================"); System.out.println("====================数据完整性开始============================");
cylinderIntegrityDataServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityData>()); cylinderIntegrityDataServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityData>());
countByRegion(regionModel -> { countByRegion(regionModel -> {
List<CylinderUnit> unitlist = cylinderUnitServiceImpl.list(new LambdaQueryWrapper<CylinderUnit>().like(CylinderUnit::getRegionCode, regionModel.getRegionCode())); List<CylinderUnit> unitlist = cylinderUnitServiceImpl.list(new LambdaQueryWrapper<CylinderUnit>()
.like(CylinderUnit::getRegionCode, regionModel.getRegionCode()));
List<CylinderIntegrityDataDto> tempList = new LinkedList<>(); List<CylinderIntegrityDataDto> tempList = new LinkedList<>();
System.out.println("====================regioncode: "+regionModel.getRegionCode()+"============================"); System.out.println(
"====================regioncode: " + regionModel.getRegionCode() + "============================");
unitlist.forEach(t -> { unitlist.forEach(t -> {
System.out.println("====================appId: "+t.getAppId()+"============================"); System.out.println("====================appId: " + t.getAppId() + "============================");
CylinderIntegrityDataDto temp = new CylinderIntegrityDataDto(); CylinderIntegrityDataDto temp = new CylinderIntegrityDataDto();
String appId = t.getAppId(); String appId = t.getAppId();
Double totalIntegirty = 0d; Double totalIntegirty = 0d;
// tz_cylinder_info // tz_cylinder_info
Double unitIntegirty = t.getIntegrity(); Double unitIntegirty = t.getIntegrity();
unitIntegirty=unitIntegirty==null?0d:unitIntegirty; unitIntegirty = unitIntegirty == null ? 0d : unitIntegirty;
//tz_cylinder_tags // tz_cylinder_tags
Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(appId); Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(appId);
tagIntegirty=tagIntegirty==null?0d:tagIntegirty; tagIntegirty = tagIntegirty == null ? 0d : tagIntegirty;
//tz_cylinder_info // tz_cylinder_info
Double infoIntegirty = this.queryIntegirtyByAppId(appId); Double infoIntegirty = this.queryIntegirtyByAppId(appId);
infoIntegirty=infoIntegirty==null?0d:infoIntegirty; infoIntegirty = infoIntegirty == null ? 0d : infoIntegirty;
// tz_cylinder_filling_record 30天内 // tz_cylinder_filling_record 30天内
Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(appId); Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(appId);
recordIntegirty=recordIntegirty==null?0d:recordIntegirty; recordIntegirty = recordIntegirty == null ? 0d : recordIntegirty;
//tz_cylinder_filling 30天内ji // tz_cylinder_filling 30天内ji
Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(appId); Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(appId);
fillingIntegirty=fillingIntegirty==null?0d:fillingIntegirty; fillingIntegirty = fillingIntegirty == null ? 0d : fillingIntegirty;
//tz_cylinder_filling_check 30天内 // tz_cylinder_filling_check 30天内
Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(appId); Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(appId);
checkIntegirty=checkIntegirty==null?0d:checkIntegirty; checkIntegirty = checkIntegirty == null ? 0d : checkIntegirty;
totalIntegirty = (unitIntegirty + tagIntegirty + infoIntegirty + recordIntegirty + fillingIntegirty + checkIntegirty) / 6; totalIntegirty = (unitIntegirty + tagIntegirty + infoIntegirty + recordIntegirty + fillingIntegirty
+ checkIntegirty) / 6;
BigDecimal bg = new BigDecimal(totalIntegirty); BigDecimal bg = new BigDecimal(totalIntegirty);
totalIntegirty = bg.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue() * 100; totalIntegirty = bg.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
temp.setAppId(appId); temp.setAppId(appId);
...@@ -303,7 +314,7 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -303,7 +314,7 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
tempList.sort(Comparator.comparing(CylinderIntegrityDataDto::getIntegrity)); tempList.sort(Comparator.comparing(CylinderIntegrityDataDto::getIntegrity));
}); });
tempList.forEach(t -> { tempList.forEach(t -> {
System.out.println("====================unitName: "+t.getUnitName()+"============================"); System.out.println("====================unitName: " + t.getUnitName() + "============================");
t.setUpdateTime(new Date()); t.setUpdateTime(new Date());
cylinderIntegrityDataServiceImpl.createWithModel(t); cylinderIntegrityDataServiceImpl.createWithModel(t);
}); });
...@@ -323,10 +334,14 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -323,10 +334,14 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(regionCode); Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(regionCode);
Double lastUnitTotal = Double.valueOf(cylinderUnitServiceImpl.getLastMonthUnitTotal(regionCode)); Double lastUnitTotal = Double.valueOf(cylinderUnitServiceImpl.getLastMonthUnitTotal(regionCode));
Double monthUnitLastInfo = Double.valueOf(cylinderUnitServiceImpl.getMonthBeforeLastUnitTotal(regionCode)); Double monthUnitLastInfo = Double.valueOf(cylinderUnitServiceImpl.getMonthBeforeLastUnitTotal(regionCode));
double changeNum = lastUnitTotal - monthUnitLastInfo; double changeNum = cylinderUnitTotal - lastUnitTotal;
double percent = 0d; double percent = 0d;
if (monthUnitLastInfo != 0) { if (monthUnitLastInfo != 0) {
percent = changeNum / monthUnitLastInfo; percent = (lastUnitTotal-monthUnitLastInfo) / monthUnitLastInfo;
BigDecimal bg = new BigDecimal(percent);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
} else {
percent = 0 ;
BigDecimal bg = new BigDecimal(percent); BigDecimal bg = new BigDecimal(percent);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
} }
...@@ -350,16 +365,22 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -350,16 +365,22 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
countByRegion(regionModel -> { countByRegion(regionModel -> {
CylinderInfoDataDto temp = new CylinderInfoDataDto(); CylinderInfoDataDto temp = new CylinderInfoDataDto();
String regionCode = String.valueOf(regionModel.getRegionCode()); String regionCode = String.valueOf(regionModel.getRegionCode());
Integer cylinderTotal = this.getInfoTotalByRegionCode(regionCode);//当前总数 Integer cylinderTotal = this.getInfoTotalByRegionCode(regionCode);// 当前总数
Double lastInfoTotal = Double.valueOf(this.getLastMonthInfoTotal(regionCode));//上月总数 Double InfoTotal = Double.valueOf(this.getMonthInfoTotal(regionCode));
Double monthBeforeLastInfo = Double.valueOf(this.getMonthBeforeLastInfoTotal(regionCode));//上上月总数 Double lastInfoTotal = Double.valueOf(this.getLastMonthInfoTotal(regionCode));// 上月总数
Double monthBeforeLastInfo = Double.valueOf(this.getMonthBeforeLastInfoTotal(regionCode));// 上上月总数
double percent = 0d; double percent = 0d;
if (monthBeforeLastInfo != 0) { if (monthBeforeLastInfo != 0) {
percent = (lastInfoTotal - monthBeforeLastInfo) / monthBeforeLastInfo; percent = (lastInfoTotal - monthBeforeLastInfo) / monthBeforeLastInfo;
BigDecimal bg = new BigDecimal(percent); BigDecimal bg = new BigDecimal(percent);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); 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();
} }
temp.setChangeSum((long) (lastInfoTotal - monthBeforeLastInfo)); temp.setChangeSum((long) (InfoTotal - lastInfoTotal));
temp.setChangePercent((int) (percent * 100) + ""); temp.setChangePercent((int) (percent * 100) + "");
temp.setRegionCode(regionCode); temp.setRegionCode(regionCode);
temp.setTotalSum((long) cylinderTotal); temp.setTotalSum((long) cylinderTotal);
...@@ -377,17 +398,24 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -377,17 +398,24 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
countByUnit(cylinderUnit -> { countByUnit(cylinderUnit -> {
CylinderInfoDataUnitDto temp = new CylinderInfoDataUnitDto(); CylinderInfoDataUnitDto temp = new CylinderInfoDataUnitDto();
temp.setAppId(cylinderUnit.getAppId()); temp.setAppId(cylinderUnit.getAppId());
int count = this.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));//当前总数 int count = this
.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));// 当前总数
temp.setTotalSum((long) count); temp.setTotalSum((long) count);
Double thismonth = Double.valueOf(baseMapper.getLastMonthInfoTotalUnit(cylinderUnit.getAppId()));//上月总数 Double month = Double.valueOf(baseMapper.getMonthInfoTotalUnit(cylinderUnit.getAppId()));
Double lastmonth = Double.valueOf(baseMapper.getMonthBeforeLastInfoTotalUnit(cylinderUnit.getAppId()));//上上月总数 Double thismonth = Double.valueOf(baseMapper.getLastMonthInfoTotalUnit(cylinderUnit.getAppId()));// 上月总数
Double lastmonth = Double.valueOf(baseMapper.getMonthBeforeLastInfoTotalUnit(cylinderUnit.getAppId()));// 上上月总数
double percent = 0d; double percent = 0d;
if (lastmonth != 0) { if (lastmonth != 0) {
percent = (thismonth - lastmonth) / lastmonth; percent = (thismonth - lastmonth) / lastmonth;
BigDecimal bg = new BigDecimal(percent); BigDecimal bg = new BigDecimal(percent);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); 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();
} }
temp.setChangeSum((long) (thismonth - lastmonth)); temp.setChangeSum((long) (month - thismonth));
temp.setChangePercent((int) (percent * 100) + ""); temp.setChangePercent((int) (percent * 100) + "");
cylinderInfoDataUnitServiceImpl.createWithModel(temp); cylinderInfoDataUnitServiceImpl.createWithModel(temp);
}); });
...@@ -413,12 +441,14 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -413,12 +441,14 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
String monthStr = month < 10 ? "0" + month : month + ""; String monthStr = month < 10 ? "0" + month : month + "";
temp.setFillingYear(year); temp.setFillingYear(year);
temp.setFillingMonth(monthStr); temp.setFillingMonth(monthStr);
//本月 // 本月
Double thisMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(), calendar.getTime()); Double thisMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(),
calendar.getTime());
temp.setTotalSum(thisMonth); temp.setTotalSum(thisMonth);
calendar.add(Calendar.MONTH, -1); calendar.add(Calendar.MONTH, -1);
//上月 // 上月
Double lastMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(), calendar.getTime()); Double lastMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(),
calendar.getTime());
double percent = 0d; double percent = 0d;
if (lastMonth != 0) { if (lastMonth != 0) {
percent = (thisMonth - lastMonth) / lastMonth; percent = (thisMonth - lastMonth) / lastMonth;
...@@ -443,8 +473,10 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -443,8 +473,10 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
countByUnit(cylinderUnit -> { countByUnit(cylinderUnit -> {
CylinderTagsDataUnitDto temp = new CylinderTagsDataUnitDto(); CylinderTagsDataUnitDto temp = new CylinderTagsDataUnitDto();
temp.setAppId(cylinderUnit.getAppId()); temp.setAppId(cylinderUnit.getAppId());
int cylinder = this.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId())); int cylinder = this
int tags = cylinderTagsServiceImpl.count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId, cylinderUnit.getAppId())); .count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));
int tags = cylinderTagsServiceImpl
.count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId, cylinderUnit.getAppId()));
double percent = 0d; double percent = 0d;
if (tags != 0) { if (tags != 0) {
percent = (double) cylinder / (double) tags; percent = (double) cylinder / (double) tags;
...@@ -538,11 +570,14 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -538,11 +570,14 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
temp.setFillingMonth(monthStr); temp.setFillingMonth(monthStr);
temp.setFillingYear(year); temp.setFillingYear(year);
temp.setFillingDate(year + "-" + monthStr); temp.setFillingDate(year + "-" + monthStr);
Integer countThisMonth = cylinderFillingRecordServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(), c.getTime()); Integer countThisMonth = cylinderFillingRecordServiceImpl
.getFillingCountByMonth(cylinderUnit.getAppId(), c.getTime());
temp.setTotalSum((long) countThisMonth); temp.setTotalSum((long) countThisMonth);
// 获取本月数据 // 获取本月数据
Integer fillingCount = cylinderFillingServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(), c.getTime()); Integer fillingCount = cylinderFillingServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(),
Integer fillingCheckCount = cylinderFillingCheckServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(), c.getTime()); c.getTime());
Integer fillingCheckCount = cylinderFillingCheckServiceImpl
.getFillingCountByMonth(cylinderUnit.getAppId(), c.getTime());
// 充装前检查率:充装前检查次数/充装次数 // 充装前检查率:充装前检查次数/充装次数
double before = 0d; double before = 0d;
if (countThisMonth != 0) { if (countThisMonth != 0) {
...@@ -560,11 +595,14 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -560,11 +595,14 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
// 充装合格率:充装前检查合格次数+充装后检查合格次数/2*充装次数 // 充装合格率:充装前检查合格次数+充装后检查合格次数/2*充装次数
double passed = 0d; double passed = 0d;
// 充装前检查合格次数 // 充装前检查合格次数
Integer fillingPassedCount = cylinderFillingServiceImpl.getFillingPassedCountByMonth(cylinderUnit.getAppId(), c.getTime()); Integer fillingPassedCount = cylinderFillingServiceImpl
.getFillingPassedCountByMonth(cylinderUnit.getAppId(), c.getTime());
// 充装后检查合格次数 // 充装后检查合格次数
Integer fillingCheckPassedCount = cylinderFillingCheckServiceImpl.getFillingPassedCountByMonth(cylinderUnit.getAppId(), c.getTime()); Integer fillingCheckPassedCount = cylinderFillingCheckServiceImpl
.getFillingPassedCountByMonth(cylinderUnit.getAppId(), c.getTime());
if (countThisMonth != 0) { if (countThisMonth != 0) {
passed = ((double) (fillingPassedCount) + (double) fillingCheckPassedCount) / (double) (2 * countThisMonth); passed = ((double) (fillingPassedCount) + (double) fillingCheckPassedCount)
/ (double) (2 * countThisMonth);
} }
temp.setFillingPassedCount((long) (fillingPassedCount + fillingCheckPassedCount)); temp.setFillingPassedCount((long) (fillingPassedCount + fillingCheckPassedCount));
temp.setTotalSumDouble((long) 2 * countThisMonth); temp.setTotalSumDouble((long) 2 * countThisMonth);
...@@ -589,7 +627,8 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -589,7 +627,8 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
for (int i = 0; i < 30; i++) { for (int i = 0; i < 30; i++) {
now.add(Calendar.DATE, -1); now.add(Calendar.DATE, -1);
CylinderFillingUnloadDataUnitDto temp = new CylinderFillingUnloadDataUnitDto(); CylinderFillingUnloadDataUnitDto temp = new CylinderFillingUnloadDataUnitDto();
Double fillingSum = cylinderFillingRecordServiceImpl.getFillingSumByDate(cylinderUnit.getAppId(), now.getTime()); Double fillingSum = cylinderFillingRecordServiceImpl.getFillingSumByDate(cylinderUnit.getAppId(),
now.getTime());
Double unloadSum = 0d; Double unloadSum = 0d;
temp.setFillingSum(fillingSum); temp.setFillingSum(fillingSum);
temp.setAppId(cylinderUnit.getAppId()); temp.setAppId(cylinderUnit.getAppId());
...@@ -669,7 +708,8 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -669,7 +708,8 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
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)
.orderByDesc(CylinderInfo::getSequenceNbr);
IPage<CylinderInfo> result = this.page(page, wrapper); IPage<CylinderInfo> result = this.page(page, wrapper);
for (CylinderInfo r : result.getRecords()) { for (CylinderInfo r : result.getRecords()) {
// 设置token // 设置token
...@@ -687,11 +727,11 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -687,11 +727,11 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
Date now = new Date(); Date now = new Date();
String dateStr; String dateStr;
try { try {
dateStr = DateUtils.dateFormat(now,DateUtils.DATE_TIME_PATTERN); dateStr = DateUtils.dateFormat(now, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) { } catch (ParseException e) {
throw new RuntimeException("日期个时候失败"); throw new RuntimeException("日期个时候失败");
} }
//1.气瓶详情 // 1.气瓶详情
CylinderInfoDto cylinderInfoDto = this.getDetail(r.getSequenceCode()); CylinderInfoDto cylinderInfoDto = this.getDetail(r.getSequenceCode());
try { try {
WarningMsgDto warningMsgDto = new WarningMsgDto(); WarningMsgDto warningMsgDto = new WarningMsgDto();
...@@ -712,13 +752,15 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -712,13 +752,15 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
} }
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())
? EarlyWarningLevelEnum.getEumByLevel(dto.getEarlyWarningLevel()).getStatus()
: "");
return dto; return dto;
} }
...@@ -732,12 +774,14 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -732,12 +774,14 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
/** /**
* 更新气瓶等级 * 更新气瓶等级
*
* @param sequenceCode 唯一表设 * @param sequenceCode 唯一表设
* @param level 等级 * @param level 等级
* @return CylinderInfo * @return CylinderInfo
*/ */
public CylinderInfo updateEarlyWarningLevel(String sequenceCode, String level) { public CylinderInfo updateEarlyWarningLevel(String sequenceCode, String level) {
CylinderInfo cylinderInfo = this.getOne(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, sequenceCode)); CylinderInfo cylinderInfo = this
.getOne(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, sequenceCode));
cylinderInfo.setEarlyWarningLevel(level); cylinderInfo.setEarlyWarningLevel(level);
cylinderInfo.setEarlyWarningLevelCalDate(new Date()); cylinderInfo.setEarlyWarningLevelCalDate(new Date());
this.updateById(cylinderInfo); this.updateById(cylinderInfo);
...@@ -748,7 +792,8 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -748,7 +792,8 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
// 1.更新下次检验日期 // 1.更新下次检验日期
List<CylinderInfo> cylinderInfos = new ArrayList<>(); List<CylinderInfo> cylinderInfos = new ArrayList<>();
cylinderInfoDtos.forEach(c -> { cylinderInfoDtos.forEach(c -> {
CylinderInfo cylinderInfo = this.getOne(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, c.getSequenceCode())); 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);
}); });
......
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,7 +19,9 @@ import java.util.List; ...@@ -16,7 +19,9 @@ 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 {
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -28,6 +33,13 @@ public class CylinderInspectionServiceImpl extends BaseService<CylinderInspectio ...@@ -28,6 +33,13 @@ public class CylinderInspectionServiceImpl extends BaseService<CylinderInspectio
* 列表查询 示例 * 列表查询 示例
*/ */
public List<CylinderInspectionDto> queryForCylinderInspectionList() { public List<CylinderInspectionDto> queryForCylinderInspectionList() {
return this.queryForList("" , false); return this.queryForList("", false);
}
/**
* 列表查询 示例
*/
public Page<CylinderInfo> queryOutOfDateCylinder(Page<CylinderInfo> pageBean,String appId) {
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,15 +28,20 @@ import java.util.Map; ...@@ -25,15 +28,20 @@ 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;
@Autowired
DataDictionaryServiceImpl iDataDictionaryService;
@Override @Override
public IPage<TzCylinderInfoDto> getCylinderInfoDtoList(PageParam pageParam, TzCylinderInfoDto tzCylinderInfoDto, String key) { public IPage<TzCylinderInfoDto> getCylinderInfoDtoList(PageParam pageParam, TzCylinderInfoDto tzCylinderInfoDto,
String key) {
Page<TzCylinderInfoDto> page = new Page<>(pageParam.getCurrent(), pageParam.getSize()); Page<TzCylinderInfoDto> page = new Page<>(pageParam.getCurrent(), pageParam.getSize());
System.out.println("key有值:"+key); System.out.println("key有值:" + key);
String superviseOrgCode = Privilege.companyClient.seleteOne(Long.valueOf(key)).getResult().getOrgCode(); String superviseOrgCode = Privilege.companyClient.seleteOne(Long.valueOf(key)).getResult().getOrgCode();
return tzCylinderMapper.getTzCylinderInfoList(page, tzCylinderInfoDto, superviseOrgCode); return tzCylinderMapper.getTzCylinderInfoList(page, tzCylinderInfoDto, superviseOrgCode);
...@@ -44,28 +52,42 @@ public class TzCylinderServiceImpl extends BaseService<TzCylinderInfoDto, Cylind ...@@ -44,28 +52,42 @@ public class TzCylinderServiceImpl extends BaseService<TzCylinderInfoDto, Cylind
String orgCode = tzCylinderMapper.getSequencCode(sequenceNbr); String orgCode = tzCylinderMapper.getSequencCode(sequenceNbr);
TzCylinderProduceDto tzCylinderProduceDto = tzCylinderMapper.getTzCylinderProduceDto(orgCode); TzCylinderProduceDto tzCylinderProduceDto = tzCylinderMapper.getTzCylinderProduceDto(orgCode);
TzCylinderInfoDto tzCylinderInfoDto = tzCylinderMapper.getTzCylinderInfoDto(sequenceNbr); 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); TzCylinderTagsDto tzCylinderTagsDto = tzCylinderMapper.getTzCylinderTagsDto(orgCode);
List<TzCylinderInspectionDto> tzCylinderInspectionDtoList = tzCylinderMapper.getTzCylinderInspectionDto(orgCode); List<TzCylinderInspectionDto> tzCylinderInspectionDtoList = tzCylinderMapper
.getTzCylinderInspectionDto(orgCode);
List<TzCylinderFillingDto> tzCylinderFillingDtoList = tzCylinderMapper.getTzCylinderFillingDto(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){
for (TzCylinderFillingDto tzCylinderFillingDto : tzCylinderFillingDtoList) {
List<TzCylinderCheckDto> tzCylinderCheckDtoListResult = new ArrayList<>(); List<TzCylinderCheckDto> tzCylinderCheckDtoListResult = new ArrayList<>();
TzCylinderBeforeCheckDto tzcylinderBeforeCheckDto = tzCylinderMapper.getTzCylinderBeforeCheck(tzCylinderFillingDto.getFillingBeforeId()); TzCylinderBeforeCheckDto tzcylinderBeforeCheckDto = tzCylinderMapper
.getTzCylinderBeforeCheck(tzCylinderFillingDto.getFillingBeforeId());
JSONObject obj = JSONObject.parseObject(JSONObject.toJSONString(tzcylinderBeforeCheckDto)); JSONObject obj = JSONObject.parseObject(JSONObject.toJSONString(tzcylinderBeforeCheckDto));
for( String str : obj.keySet()) for (String str : obj.keySet()) {
{
String explain = map.get(str); String explain = map.get(str);
String value = String.valueOf(obj.get(str)) ; String value = String.valueOf(obj.get(str));
TzCylinderCheckDto tzcylinderCheckDto = new TzCylinderCheckDto(str,explain,value); DataDictionary data = iDataDictionaryService
.getOne(new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getSequenceNbr, value));
TzCylinderCheckDto tzcylinderCheckDto = new TzCylinderCheckDto(str, explain,
data != null ? data.getCode() : null);
tzCylinderCheckDtoListResult.add(tzcylinderCheckDto); tzCylinderCheckDtoListResult.add(tzcylinderCheckDto);
} }
tzCylinderFillingDto.setTzCylinderCheckDtoList(tzCylinderCheckDtoListResult); tzCylinderFillingDto.setTzCylinderCheckDtoList(tzCylinderCheckDtoListResult);
...@@ -75,25 +97,28 @@ public class TzCylinderServiceImpl extends BaseService<TzCylinderInfoDto, Cylind ...@@ -75,25 +97,28 @@ public class TzCylinderServiceImpl extends BaseService<TzCylinderInfoDto, Cylind
* 取气瓶追溯详情 充装后检查项 名称和结果列表 * 取气瓶追溯详情 充装后检查项 名称和结果列表
*/ */
List<TzCylinderCheckDto> tzCylinderAfterCheckDtoList = tzCylinderMapper.getTzCylinderAfterCheckItem(); List<TzCylinderCheckDto> tzCylinderAfterCheckDtoList = tzCylinderMapper.getTzCylinderAfterCheckItem();
Map<String,String> afterMap = new HashMap<>(); Map<String, String> afterMap = new HashMap<>();
for(TzCylinderCheckDto tzCylinderCheckDto : tzCylinderAfterCheckDtoList){ for (TzCylinderCheckDto tzCylinderCheckDto : tzCylinderAfterCheckDtoList) {
afterMap.put(tzCylinderCheckDto.getItem(), tzCylinderCheckDto.getExplain()); afterMap.put(tzCylinderCheckDto.getItem(), tzCylinderCheckDto.getExplain());
} }
for(TzCylinderFillingDto tzCylinderFillingDto : tzCylinderFillingDtoList){ for (TzCylinderFillingDto tzCylinderFillingDto : tzCylinderFillingDtoList) {
List<TzCylinderCheckDto> tzCylinderAfterCheckDtoListResult = new ArrayList<>(); List<TzCylinderCheckDto> tzCylinderAfterCheckDtoListResult = new ArrayList<>();
TzCylinderAfterCheckDto tzcylinderAfterCheckDto = tzCylinderMapper.getTzCylinderAfterCheck(tzCylinderFillingDto.getFillingCheckId()); TzCylinderAfterCheckDto tzcylinderAfterCheckDto = tzCylinderMapper
.getTzCylinderAfterCheck(tzCylinderFillingDto.getFillingCheckId());
JSONObject obj = JSONObject.parseObject(JSONObject.toJSONString(tzcylinderAfterCheckDto)); JSONObject obj = JSONObject.parseObject(JSONObject.toJSONString(tzcylinderAfterCheckDto));
for( String str : obj.keySet()) for (String str : obj.keySet()) {
{
String explain = afterMap.get(str); String explain = afterMap.get(str);
String value = String.valueOf(obj.get(str)) ; String value = String.valueOf(obj.get(str));
TzCylinderCheckDto tzcylinderCheckDto = new TzCylinderCheckDto(str,explain,value); 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); tzCylinderAfterCheckDtoListResult.add(tzcylinderCheckDto);
} }
tzCylinderFillingDto.setTzCylinderAfterCheckDtoList(tzCylinderAfterCheckDtoListResult); tzCylinderFillingDto.setTzCylinderAfterCheckDtoList(tzCylinderAfterCheckDtoListResult);
} }
return new TzCylinderTraceDto(tzCylinderProduceDto, tzCylinderInfoDto, tzCylinderTagsDto,
return new TzCylinderTraceDto(tzCylinderProduceDto,tzCylinderInfoDto,tzCylinderTagsDto,tzCylinderInspectionDtoList,tzCylinderFillingDtoList); 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