对比新文件 |
| | |
| | | package com.gk.firework.Service.ServiceImpl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.gk.firework.Domain.Enterprise; |
| | | import com.gk.firework.Domain.EnterpriseApply; |
| | | import com.gk.firework.Domain.Enum.ApplyStatus; |
| | | import com.gk.firework.Domain.Enum.CommitStatus; |
| | | import com.gk.firework.Domain.UserInfo; |
| | | import com.gk.firework.Domain.Utils.StringUtils; |
| | | import com.gk.firework.Domain.Vo.ApprovalVo; |
| | | import com.gk.firework.Mapper.EnterpriseApplyMapper; |
| | | import com.gk.firework.Service.EnterpriseApplyService; |
| | | import com.gk.firework.Service.EnterpriseService; |
| | | import com.gk.firework.Service.UserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.util.*; |
| | | |
| | | @Service("enterpriseApplyService") |
| | | public class EnterpriseApplyServiceImpl extends ServiceImpl<EnterpriseApplyMapper, EnterpriseApply> implements EnterpriseApplyService { |
| | | |
| | | @Autowired |
| | | private EnterpriseApplyMapper enterpriseApplyMapper; |
| | | @Autowired |
| | | private EnterpriseService enterpriseService; |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @Override |
| | | public IPage<EnterpriseApply> selectEnterpriseApply(Page<EnterpriseApply> page, EnterpriseApply enterpriseApplyFilter,UserInfo user) { |
| | | UserInfo userInfo = userService.getById(user.getId()); |
| | | LambdaQueryWrapper<EnterpriseApply> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.select(EnterpriseApply::getId, |
| | | EnterpriseApply::getApplytime, |
| | | EnterpriseApply::getApplypersonname, |
| | | EnterpriseApply::getProcesstime, |
| | | EnterpriseApply::getProcesspersonname, |
| | | EnterpriseApply::getApplystatus |
| | | ) |
| | | .orderByDesc(EnterpriseApply::getApplytime) |
| | | .eq(EnterpriseApply::getValidflag, true); |
| | | |
| | | //企业用户 |
| | | if (userInfo.getCompanyid() != null) { |
| | | queryWrapper.eq(EnterpriseApply::getId, userInfo.getCompanyid()); |
| | | } |
| | | //监管部门 根据 地区看所有 |
| | | if(userInfo.getType()==3){ |
| | | if (StringUtils.isNotBlank(userInfo.getProvince())) |
| | | queryWrapper.eq(EnterpriseApply::getProvince, userInfo.getProvince()); |
| | | if (StringUtils.isNotBlank(userInfo.getCity())) |
| | | queryWrapper.eq(EnterpriseApply::getCity, userInfo.getCity()); |
| | | if (StringUtils.isNotBlank(userInfo.getArea())) |
| | | queryWrapper.eq(EnterpriseApply::getDistrict, userInfo.getArea()); |
| | | if (StringUtils.isNotBlank(userInfo.getTown())) |
| | | queryWrapper.eq(EnterpriseApply::getStreet, userInfo.getTown()); |
| | | if (StringUtils.isNotBlank(userInfo.getCommunity())) |
| | | queryWrapper.eq(EnterpriseApply::getCommittee, userInfo.getCommunity()); |
| | | } |
| | | return this.page(page, queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List getApplyList(EnterpriseApply enterpriseApplyFilter) { |
| | | LambdaQueryWrapper<EnterpriseApply> queryWrapper = new LambdaQueryWrapper<>(); |
| | | return enterpriseApplyMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description: |
| | | * @param enterprise 需要更新字段的对象 updateObj 更新字段 |
| | | */ |
| | | private void updateSetFields(Enterprise enterprise, JSONObject updateObj) throws NoSuchFieldException, IllegalAccessException { |
| | | Map<String, Object> innerMap = updateObj.getInnerMap(); |
| | | assert innerMap.size() > 0; |
| | | for (Map.Entry<String, Object> entry : innerMap.entrySet()) { |
| | | String field = entry.getKey(); |
| | | Field declaredField = enterprise.getClass().getDeclaredField(field); |
| | | declaredField.setAccessible(true); |
| | | declaredField.set(enterprise, entry.getValue()); |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |