|
|
@ -7,20 +7,27 @@ import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.ccsens.health.bean.dto.AbnormalDto; |
|
|
|
import com.ccsens.health.bean.po.HealthAbnormal; |
|
|
|
import com.ccsens.health.bean.po.HealthQRCode; |
|
|
|
import com.ccsens.health.bean.po.HealthQRCodeExample; |
|
|
|
import com.ccsens.health.bean.po.HealthRecords; |
|
|
|
import com.ccsens.health.bean.vo.AbnormalVo; |
|
|
|
import com.ccsens.health.persist.dao.HealthAbnormalDao; |
|
|
|
import com.ccsens.health.persist.dao.HealthQRCodeDao; |
|
|
|
import com.ccsens.util.CodeEnum; |
|
|
|
import com.ccsens.util.bean.dto.QueryDto; |
|
|
|
import com.ccsens.util.exception.BaseException; |
|
|
|
import com.ccsens.util.wx.WxXcxUtil; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.concurrent.Future; |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
@ -30,9 +37,16 @@ public class AbnormalService implements IAbnormalService{ |
|
|
|
private Snowflake snowflake; |
|
|
|
@Autowired |
|
|
|
private HealthAbnormalDao healthAbnormalDao; |
|
|
|
@Autowired |
|
|
|
private HealthQRCodeDao healthQRCodeDao; |
|
|
|
@Autowired |
|
|
|
private IAsyncService asyncService; |
|
|
|
@Value("spring.profiles.active") |
|
|
|
private String active; |
|
|
|
|
|
|
|
/** |
|
|
|
* 疫情概览 |
|
|
|
* |
|
|
|
* @param params |
|
|
|
* @return |
|
|
|
*/ |
|
|
@ -64,7 +78,7 @@ public class AbnormalService implements IAbnormalService{ |
|
|
|
* @param params |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public AbnormalVo.AbnormalStatisticsVo addAbnormal(QueryDto<AbnormalDto.AddAbnormal> params) { |
|
|
|
public AbnormalVo.AbnormalStatisticsVo addAbnormal(QueryDto<AbnormalDto.AddAbnormal> params) throws Exception { |
|
|
|
AbnormalDto.AddAbnormal addAbnormal = params.getParam(); |
|
|
|
HealthAbnormal healthAbnormal = new HealthAbnormal(); |
|
|
|
healthAbnormal.setId(snowflake.nextId()); |
|
|
@ -72,6 +86,33 @@ public class AbnormalService implements IAbnormalService{ |
|
|
|
healthAbnormal.setHealthStatus((short) addAbnormal.getHealthType()); |
|
|
|
healthAbnormalDao.insertSelective(healthAbnormal); |
|
|
|
|
|
|
|
//如果是确诊状态,检查该学生最新上报的健康信息,将二维码换成红色
|
|
|
|
Future<String> future = null; |
|
|
|
if (addAbnormal.getHealthType() == 4) { |
|
|
|
HealthRecords healthRecords = healthAbnormalDao.selectHealthRecordByWkno(addAbnormal.getWkno()); |
|
|
|
if (ObjectUtil.isNotNull(healthAbnormal)) { |
|
|
|
if ("prod".equals(active)) { |
|
|
|
WxXcxUtil.LineColor color = new WxXcxUtil.LineColor(); |
|
|
|
color.r = "226"; |
|
|
|
color.g = "32"; |
|
|
|
color.b = "24"; |
|
|
|
future = asyncService.generateQRCode("d=" + healthRecords.getUserId(), color); |
|
|
|
log.info("调用微信生成二维码"); |
|
|
|
HealthQRCodeExample healthQRCodeExample = new HealthQRCodeExample(); |
|
|
|
healthQRCodeExample.createCriteria().andHealthRecordsIdEqualTo(healthRecords.getId()); |
|
|
|
List<HealthQRCode> healthQRCodeList = healthQRCodeDao.selectByExample(healthQRCodeExample); |
|
|
|
if(CollectionUtil.isNotEmpty(healthQRCodeList)){ |
|
|
|
HealthQRCode healthQRCode = healthQRCodeList.get(0); |
|
|
|
if(future != null){ |
|
|
|
healthQRCode.setQrcodePath(future.get()); |
|
|
|
healthQRCodeDao.updateByPrimaryKeySelective(healthQRCode); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
log.info("测试环境,不调用生成二维码"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
AbnormalVo.AbnormalStatisticsVo abnormalStatisticsVo = new AbnormalVo.AbnormalStatisticsVo(); |
|
|
|
BeanUtil.copyProperties(healthAbnormal, abnormalStatisticsVo); |
|
|
|
abnormalStatisticsVo.setHealthType(healthAbnormal.getHealthStatus()); |
|
|
@ -94,6 +135,7 @@ public class AbnormalService implements IAbnormalService{ |
|
|
|
|
|
|
|
/** |
|
|
|
* 修改异常人员信息 |
|
|
|
* |
|
|
|
* @param params |
|
|
|
*/ |
|
|
|
@Override |
|
|
@ -133,6 +175,7 @@ public class AbnormalService implements IAbnormalService{ |
|
|
|
|
|
|
|
/** |
|
|
|
* 删除异常人员信息 |
|
|
|
* |
|
|
|
* @param params |
|
|
|
*/ |
|
|
|
@Override |
|
|
|