|  |  |  | 
|---|
|  |  |  | import doumeemes.dao.business.model.CompanyLog; | 
|---|
|  |  |  | import doumeemes.dao.business.model.Multifiles; | 
|---|
|  |  |  | import doumeemes.dao.ext.dto.DingDingConfig; | 
|---|
|  |  |  | import doumeemes.dao.ext.vo.CompanyExtListVO; | 
|---|
|  |  |  | import doumeemes.service.business.CompanyLogService; | 
|---|
|  |  |  | import doumeemes.service.business.CompanyService; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import doumeemes.service.business.MultifilesService; | 
|---|
|  |  |  | import doumeemes.service.ext.DepartmentExtService; | 
|---|
|  |  |  | import org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | import org.apache.shiro.SecurityUtils; | 
|---|
|  |  |  | import org.springframework.beans.BeanUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.context.annotation.Lazy; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.util.CollectionUtils; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CompanyLogService companyLogService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | @Lazy | 
|---|
|  |  |  | private DepartmentExtService departmentExtService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Integer create(Company company) { | 
|---|
|  |  |  | 
|---|
|  |  |  | company.setUpdateUser(user.getId()); | 
|---|
|  |  |  | company.setDeleted(Constants.ONE); | 
|---|
|  |  |  | companyMapper.updateById(company); | 
|---|
|  |  |  | Company company1 = companyMapper.selectById(company.getId()); | 
|---|
|  |  |  | initRedisCache(company1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | update.setStatus(company.getStatus()); | 
|---|
|  |  |  | update.setDingdingInfo(company.getDingdingInfo()); | 
|---|
|  |  |  | companyMapper.updateById(update); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //        更新记录 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | CompanyLog companyLog = new CompanyLog(); | 
|---|
|  |  |  | companyLog.setDeleted((byte)Constants.ZERO); | 
|---|
|  |  |  | companyLog.setUpdateUser(principal.getId()); | 
|---|
|  |  |  | companyLog.setCreateUser(principal.getId()); | 
|---|
|  |  |  | companyLog.setCreateTime(new Date()); | 
|---|
|  |  |  | companyLog.setUpdateTime(new Date()); | 
|---|
|  |  |  | companyLog.setCompanyId(company.getId()); | 
|---|
|  |  |  | if(Objects.nonNull(company.getStatus())){ | 
|---|
|  |  |  | CompanyLog companyLog = new CompanyLog(); | 
|---|
|  |  |  | companyLog.setDeleted((byte)Constants.ZERO); | 
|---|
|  |  |  | companyLog.setUpdateUser(principal.getId()); | 
|---|
|  |  |  | companyLog.setCreateUser(principal.getId()); | 
|---|
|  |  |  | companyLog.setCreateTime(new Date()); | 
|---|
|  |  |  | companyLog.setUpdateTime(new Date()); | 
|---|
|  |  |  | companyLog.setRemark(company.getStatus() == 1 ? "数据启用" : "数据禁用"); | 
|---|
|  |  |  | companyLog.setCompanyId(company.getId()); | 
|---|
|  |  |  | companyLog.setUpdateType(company.getStatus() == 1 ? Constants.CompanyUpdateType.UPDATE_ENABLE.getKey() | 
|---|
|  |  |  | : Constants.CompanyUpdateType.UPDATE_DISABLE.getKey()); | 
|---|
|  |  |  | companyLog.setDetail(company.getStatus() == 1 ? "数据启用" : "数据禁用"); | 
|---|
|  |  |  | companyLogService.create(companyLog); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | CompanyLog companyLog = new CompanyLog(); | 
|---|
|  |  |  | companyLog.setDeleted((byte)Constants.ZERO); | 
|---|
|  |  |  | companyLog.setUpdateUser(principal.getId()); | 
|---|
|  |  |  | companyLog.setCreateUser(principal.getId()); | 
|---|
|  |  |  | companyLog.setCreateTime(new Date()); | 
|---|
|  |  |  | companyLog.setUpdateTime(new Date()); | 
|---|
|  |  |  | companyLog.setRemark("更新企业数据"); | 
|---|
|  |  |  | companyLog.setCompanyId(company.getId()); | 
|---|
|  |  |  | companyLog.setUpdateType(Constants.CompanyUpdateType.UPDATE_CONTENT.getKey()); | 
|---|
|  |  |  | companyLog.setDetail("更新企业数据"); | 
|---|
|  |  |  | companyLogService.create(companyLog); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | companyLogService.create(companyLog); | 
|---|
|  |  |  | Company company1 = companyMapper.selectById(company.getId()); | 
|---|
|  |  |  | initRedisCache(company1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void initRedisCache(Company com) { | 
|---|
|  |  |  | CompanyExtListVO c = new CompanyExtListVO(); | 
|---|
|  |  |  | BeanUtils.copyProperties(com,c); | 
|---|
|  |  |  | departmentExtService.loadComDepart(c); | 
|---|
|  |  |  | departmentExtService.initCompnayCodesByCom(com); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Boolean isParseObject(String dingdingInfo){ | 
|---|
|  |  |  | 
|---|
|  |  |  | QueryWrapper<Company> wrapper = new QueryWrapper<>(company); | 
|---|
|  |  |  | return companyMapper.selectList(wrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public PageData<Company> findPage(PageWrap<Company> pageWrap) { | 
|---|
|  |  |  | IPage<Company> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); | 
|---|