| | |
| | | import com.thhy.secure.modules.biz.hiddenDanger.entity.HiddenDangerEntity; |
| | | import com.thhy.secure.modules.biz.hiddenDanger.mapper.HiddenDangerMapper; |
| | | import com.thhy.secure.modules.biz.hiddenDanger.service.HiddenDangerService; |
| | | import com.thhy.secure.modules.biz.integralAccount.entity.IntegralAccountEntity; |
| | | import com.thhy.secure.modules.biz.integralAccount.entity.IntegralDetailEntity; |
| | | import com.thhy.secure.modules.biz.integralAccount.mapper.IntegralDetailMapper; |
| | | import com.thhy.secure.modules.biz.regionInspection.mapper.RegionInspectionRecordMapper; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @Author QiuYuHao |
| | |
| | | @Autowired |
| | | private HiddenDangerMapper hiddenDangerMapper; |
| | | |
| | | @Autowired |
| | | private IntegralDetailMapper integralDetailMapper; |
| | | |
| | | @Autowired |
| | | private RegionInspectionRecordMapper regionInspectionRecordMapper; |
| | | private static final Object Lock = new Object(); |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo(); |
| | | String userId = sysUserInfo.getUserId(); |
| | | hiddenDangerEntity.setUpdateUser(userId); |
| | | if (hiddenDangerEntity.getDictId() != null){ |
| | | hiddenDangerEntity.setDangerLocation(hiddenDangerEntity.getDictId()); |
| | | } |
| | | hiddenDangerEntity.setUpdateTime(new Date()); |
| | | synchronized (Lock){ |
| | | hiddenDangerMapper.update(hiddenDangerEntity); |
| | |
| | | map.put("companyId",sysUserInfo.getCompanyId()); |
| | | int pageNum = (int) map.get("pageNum"); |
| | | int pageSize = (int) map.get("pageSize"); |
| | | int type = (int) map.get("type");//type =1 小程序来的 |
| | | int type = 0; |
| | | if( map.get("type")!= null){ |
| | | type = (int) map.get("type");//type =1 小程序来的 |
| | | } |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<HiddenDangerEntity> hiddenDangerEntities = new ArrayList<>(); |
| | | if(type == 1){ |
| | | if(type == 1){//审核列表 |
| | | //小程序 待审核排前面 待审核按时间正序 审核成功的倒叙 |
| | | hiddenDangerEntities = hiddenDangerMapper.selectAppList(map); |
| | | }else { |
| | | }else if(type == 2){//隐患举报详情列表 |
| | | map.put("createUser",sysUserInfo.getUserId()); |
| | | //小程序 待审核排前面 待审核按时间正序 审核成功的倒叙 |
| | | hiddenDangerEntities = hiddenDangerMapper.selectPageList(map); |
| | | } else { |
| | | //web 按时间倒序 |
| | | hiddenDangerEntities = hiddenDangerMapper.selectPageList(map); |
| | | } |
| | |
| | | obj.setAuditStatusName("未审核"); |
| | | break; |
| | | case 1: |
| | | obj.setAuditStatusName("审核通过"); |
| | | obj.setAuditStatusName("已审核"); |
| | | break; |
| | | case 2: |
| | | obj.setAuditStatusName("审核失败"); |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public BasicResult examine(HiddenDangerEntity hiddenDangerEntity) { |
| | | SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo(); |
| | | String platUserId = regionInspectionRecordMapper.selectPlatUserId(hiddenDangerEntity.getCreateUser()); |
| | | |
| | | Map platUser = regionInspectionRecordMapper.getPlatUser(platUserId); |
| | | int user_type = (int) platUser.get("user_type"); |
| | | Map account = new HashMap(); |
| | | account.put("userId",platUserId); |
| | | //查询账户 |
| | | IntegralAccountEntity queryAccount = integralDetailMapper.selectByOne(account); |
| | | Double accumulateIntegral = 0.0; |
| | | Double totalIntegral = 0.0; |
| | | if (queryAccount != null){ |
| | | accumulateIntegral = queryAccount.getAccumulateIntegral();//累计积分 |
| | | totalIntegral = queryAccount.getTotalIntegral();//当前余额 |
| | | } |
| | | hiddenDangerEntity.setAuditStatus(1);//1审核通过 |
| | | hiddenDangerMapper.update(hiddenDangerEntity); |
| | | hiddenDangerEntity.setDangerLocation(null); |
| | | hiddenDangerEntity.setAuditTime(new Date()); |
| | | hiddenDangerEntity.setAuditUser(sysUserInfo.getUserId()); |
| | | synchronized (Lock){ |
| | | hiddenDangerMapper.update(hiddenDangerEntity); |
| | | IntegralAccountEntity integralAccountEntity = IntegralAccountEntity |
| | | .builder() |
| | | .userId(platUserId) |
| | | .id(UUIDUtils.create()) |
| | | .accumulateIntegral(accumulateIntegral+hiddenDangerEntity.getIntegral()) |
| | | .totalIntegral(totalIntegral+hiddenDangerEntity.getIntegral()) |
| | | .userType(user_type) |
| | | .build(); |
| | | |
| | | IntegralDetailEntity integralDetailEntity = IntegralDetailEntity |
| | | .builder() |
| | | .id(UUIDUtils.create()) |
| | | .balanc(totalIntegral+hiddenDangerEntity.getIntegral()) |
| | | .integralSource("隐患审核") |
| | | .integralWater(hiddenDangerEntity.getIntegral()) |
| | | .createTime(new Date()) |
| | | .createUser(sysUserInfo.getUserId()) |
| | | .userType(user_type) |
| | | .userId(platUserId) |
| | | .type(1) |
| | | .remark("隐患审核") |
| | | .companyId(sysUserInfo.getCompanyId()) |
| | | .build(); |
| | | |
| | | integralDetailMapper.insertAndUpdateAccount(integralAccountEntity); |
| | | integralDetailMapper.insertDetailAndUpdate(integralDetailEntity); |
| | | } |
| | | return BasicResult.success(); |
| | | } |
| | | } |