|
@@ -1,5 +1,6 @@
|
|
package com.qunzhixinxi.hnqz.admin.service.impl;
|
|
package com.qunzhixinxi.hnqz.admin.service.impl;
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
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;
|
|
@@ -37,37 +38,37 @@ import java.util.Map;
|
|
@AllArgsConstructor
|
|
@AllArgsConstructor
|
|
public class WmDaDrugEntServiceImpl extends ServiceImpl<WmDaDrugEntMapper, WmDaDrugEnt> implements WmDaDrugEntService {
|
|
public class WmDaDrugEntServiceImpl extends ServiceImpl<WmDaDrugEntMapper, WmDaDrugEnt> implements WmDaDrugEntService {
|
|
|
|
|
|
- private final SysDeptService sysDeptService;
|
|
|
|
- private final WmDaDrugEntMapper wmDaDrugEntMapper;
|
|
|
|
- private final SysDeptRelationService sysDeptRelationService;
|
|
|
|
- private final WmTaskSubmissionRuleService taskSubmissionRuleService;
|
|
|
|
- private final SysEnterpriseAreaService enterpriseAreaService;
|
|
|
|
- private final WmTaskSubmissionPercentRuleService taskSubmissionPercentRuleService;
|
|
|
|
- private final SysUserAreaService sysUserAreaService;
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
- public boolean saveDrugEnt(WmDaDrugEnt entity) {
|
|
|
|
- Integer deptId = Integer.parseInt(System.currentTimeMillis() / 1000 + "");
|
|
|
|
- entity.setDeptId(deptId);
|
|
|
|
- entity.setCreateTime(LocalDateTime.now());
|
|
|
|
- boolean isSave = super.save(entity);
|
|
|
|
- if (isSave) {
|
|
|
|
- SysDept sysDept = new SysDept();
|
|
|
|
- sysDept.setDeptId(deptId);
|
|
|
|
- sysDept.setName(entity.getEntname());
|
|
|
|
- sysDept.setLevel(2);
|
|
|
|
- sysDept.setLevel1Id(entity.getId());
|
|
|
|
- sysDept.setLevel1Name(entity.getEntname());
|
|
|
|
- sysDept.setTaxCode(entity.getEntcode());
|
|
|
|
- sysDept.setFinancialReviewType(entity.getFinancialReviewType());
|
|
|
|
- sysDept.setDeptPermissions(entity.getDeptPermissions());
|
|
|
|
- /**
|
|
|
|
- * @Modify: start
|
|
|
|
- * @Author: ryz
|
|
|
|
- * @Date: 2021/4/19
|
|
|
|
- */
|
|
|
|
- if(sysDeptService.saveDept(sysDept) > 0){
|
|
|
|
|
|
+ private final SysDeptService sysDeptService;
|
|
|
|
+ private final WmDaDrugEntMapper wmDaDrugEntMapper;
|
|
|
|
+ private final SysDeptRelationService sysDeptRelationService;
|
|
|
|
+ private final WmTaskSubmissionRuleService taskSubmissionRuleService;
|
|
|
|
+ private final SysEnterpriseAreaService enterpriseAreaService;
|
|
|
|
+ private final WmTaskSubmissionPercentRuleService taskSubmissionPercentRuleService;
|
|
|
|
+ private final SysUserAreaService sysUserAreaService;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public boolean saveDrugEnt(WmDaDrugEnt entity) {
|
|
|
|
+ Integer deptId = Integer.parseInt(System.currentTimeMillis() / 1000 + "");
|
|
|
|
+ entity.setDeptId(deptId);
|
|
|
|
+ entity.setCreateTime(LocalDateTime.now());
|
|
|
|
+ boolean isSave = super.save(entity);
|
|
|
|
+ if (isSave) {
|
|
|
|
+ SysDept sysDept = new SysDept();
|
|
|
|
+ sysDept.setDeptId(deptId);
|
|
|
|
+ sysDept.setName(entity.getEntname());
|
|
|
|
+ sysDept.setLevel(2);
|
|
|
|
+ sysDept.setLevel1Id(entity.getId());
|
|
|
|
+ sysDept.setLevel1Name(entity.getEntname());
|
|
|
|
+ sysDept.setTaxCode(entity.getEntcode());
|
|
|
|
+ sysDept.setFinancialReviewType(entity.getFinancialReviewType());
|
|
|
|
+ sysDept.setDeptPermissions(entity.getDeptPermissions());
|
|
|
|
+ /**
|
|
|
|
+ * @Modify: start
|
|
|
|
+ * @Author: ryz
|
|
|
|
+ * @Date: 2021/4/19
|
|
|
|
+ */
|
|
|
|
+ if (sysDeptService.saveDept(sysDept) > 0) {
|
|
|
|
|
|
// Map<String, Integer> subjectTypeAndChannel = entity.getSubjectTypeAndChannel();
|
|
// Map<String, Integer> subjectTypeAndChannel = entity.getSubjectTypeAndChannel();
|
|
// if (CollUtil.isNotEmpty(subjectTypeAndChannel)) {
|
|
// if (CollUtil.isNotEmpty(subjectTypeAndChannel)) {
|
|
@@ -82,103 +83,109 @@ public class WmDaDrugEntServiceImpl extends ServiceImpl<WmDaDrugEntMapper, WmDaD
|
|
//
|
|
//
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
- return true;
|
|
|
|
- }
|
|
|
|
- return false;
|
|
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
|
|
- /**
|
|
|
|
- * @Modify: end
|
|
|
|
- */
|
|
|
|
|
|
+ /**
|
|
|
|
+ * @Modify: end
|
|
|
|
+ */
|
|
|
|
|
|
// return sysDeptService.saveDept(sysDept) > 0 ? true : false;
|
|
// return sysDeptService.saveDept(sysDept) > 0 ? true : false;
|
|
- }
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public List<WmDaDrugEnt> selectByScope(Wrapper<WmDaDrugEnt> queryWrapper) {
|
|
|
|
- return wmDaDrugEntMapper.selectListByScope(queryWrapper, new DataScope());
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public boolean saveDrugEnts(WmDaDrugEnt entity) {
|
|
|
|
-
|
|
|
|
- LocalDateTime now = LocalDateTime.now();
|
|
|
|
- Integer deptId = (int) System.currentTimeMillis() / 1000;
|
|
|
|
- entity.setDeptId(deptId);
|
|
|
|
- entity.setCreateTime(now);
|
|
|
|
- entity.setCreateUser(SecurityUtils.getUser().getId());
|
|
|
|
-
|
|
|
|
- if (super.save(entity)) {
|
|
|
|
- SysDept sysDept = new SysDept();
|
|
|
|
- sysDept.setDeptId(deptId);
|
|
|
|
- sysDept.setName(entity.getEntname());
|
|
|
|
- sysDept.setLevel(2);
|
|
|
|
- sysDept.setDeptPermissions(entity.getDeptPermissions());
|
|
|
|
- sysDept.setFinancialReviewType(entity.getFinancialReviewType());
|
|
|
|
- sysDept.setExpiryDate(now.plusYears(1L).toLocalDate());
|
|
|
|
- sysDeptService.save(sysDept);
|
|
|
|
-
|
|
|
|
- List<SysDeptRelation> newList = new ArrayList<>(2);
|
|
|
|
- SysDeptRelation sysDeptRelation = new SysDeptRelation();
|
|
|
|
- sysDeptRelation.setAncestor(SecurityUtils.getUser().getDeptId());
|
|
|
|
- sysDeptRelation.setDescendant(deptId);
|
|
|
|
- newList.add(sysDeptRelation);
|
|
|
|
- SysDeptRelation sysDeptRelation1 = new SysDeptRelation();
|
|
|
|
- sysDeptRelation1.setAncestor(deptId);
|
|
|
|
- sysDeptRelation1.setDescendant(deptId);
|
|
|
|
- newList.add(sysDeptRelation1);
|
|
|
|
- sysDeptRelationService.saveBatch(newList);
|
|
|
|
-
|
|
|
|
- // 初始化任务规则
|
|
|
|
- taskSubmissionRuleService.initDeptTaskSubmissionRule(Collections.singleton(deptId));
|
|
|
|
- // 初始化企业的任务类型配置的信息
|
|
|
|
- taskSubmissionPercentRuleService.initTaskTypeConfigRule(Collections.singleton(deptId));
|
|
|
|
-
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public WmDaDrugEnt selectByDeptId(Integer deptId) {
|
|
|
|
- return wmDaDrugEntMapper.selectByDeptId(deptId);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public List<Map<String, Object>> selectEntNameByDeptId(Integer deptId) {
|
|
|
|
- return wmDaDrugEntMapper.selectEntNameByDeptId(deptId);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public List selectEntNameByByDeptIds(Integer upId) {
|
|
|
|
- return wmDaDrugEntMapper.selectEntNameByByDeptIds(upId);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public List<WmDaDrugEnt> getListByCsoDeptId(Integer deptId) {
|
|
|
|
- return wmDaDrugEntMapper.getListByCsoDeptId(deptId);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 分页查询
|
|
|
|
- *
|
|
|
|
- * @param page 分页对象
|
|
|
|
- * @param wmDaDrugEnt 实体对象
|
|
|
|
- */
|
|
|
|
- @Override
|
|
|
|
- public void selectPage(Page<WmDaDrugEnt> page, WmDaDrugEnt wmDaDrugEnt) {
|
|
|
|
-
|
|
|
|
- List<Long> areas = sysUserAreaService.listUserAreas(Long.valueOf(SecurityUtils.getUser().getId()));
|
|
|
|
-
|
|
|
|
- List<Long> ents = enterpriseAreaService.listAreaEnts(areas);
|
|
|
|
- wmDaDrugEnt.setEntIds(ents);
|
|
|
|
- wmDaDrugEntMapper.selectPage(page, wmDaDrugEnt);
|
|
|
|
- page.getRecords().forEach(ent -> {
|
|
|
|
- List<Long> areaCodes = enterpriseAreaService.listEntAreas(Collections.singletonList(Long.valueOf(ent.getDeptId())));
|
|
|
|
- ent.setAreaCodes(areaCodes);;
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<WmDaDrugEnt> selectByScope(Wrapper<WmDaDrugEnt> queryWrapper) {
|
|
|
|
+ return wmDaDrugEntMapper.selectListByScope(queryWrapper, new DataScope());
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean saveDrugEnts(WmDaDrugEnt entity) {
|
|
|
|
+
|
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
|
+ Integer deptId = (int) System.currentTimeMillis() / 1000;
|
|
|
|
+ entity.setDeptId(deptId);
|
|
|
|
+ entity.setCreateTime(now);
|
|
|
|
+ entity.setCreateUser(SecurityUtils.getUser().getId());
|
|
|
|
+
|
|
|
|
+ if (super.save(entity)) {
|
|
|
|
+ SysDept sysDept = new SysDept();
|
|
|
|
+ sysDept.setDeptId(deptId);
|
|
|
|
+ sysDept.setName(entity.getEntname());
|
|
|
|
+ sysDept.setLevel(2);
|
|
|
|
+ sysDept.setDeptPermissions(entity.getDeptPermissions());
|
|
|
|
+ sysDept.setFinancialReviewType(entity.getFinancialReviewType());
|
|
|
|
+ sysDept.setExpiryDate(now.plusYears(1L).toLocalDate());
|
|
|
|
+ sysDeptService.save(sysDept);
|
|
|
|
+
|
|
|
|
+ List<SysDeptRelation> newList = new ArrayList<>(2);
|
|
|
|
+ SysDeptRelation sysDeptRelation = new SysDeptRelation();
|
|
|
|
+ sysDeptRelation.setAncestor(SecurityUtils.getUser().getDeptId());
|
|
|
|
+ sysDeptRelation.setDescendant(deptId);
|
|
|
|
+ newList.add(sysDeptRelation);
|
|
|
|
+ SysDeptRelation sysDeptRelation1 = new SysDeptRelation();
|
|
|
|
+ sysDeptRelation1.setAncestor(deptId);
|
|
|
|
+ sysDeptRelation1.setDescendant(deptId);
|
|
|
|
+ newList.add(sysDeptRelation1);
|
|
|
|
+ sysDeptRelationService.saveBatch(newList);
|
|
|
|
+
|
|
|
|
+ // 初始化任务规则
|
|
|
|
+ taskSubmissionRuleService.initDeptTaskSubmissionRule(Collections.singleton(deptId));
|
|
|
|
+ // 初始化企业的任务类型配置的信息
|
|
|
|
+ taskSubmissionPercentRuleService.initTaskTypeConfigRule(Collections.singleton(deptId));
|
|
|
|
+
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public WmDaDrugEnt selectByDeptId(Integer deptId) {
|
|
|
|
+ return wmDaDrugEntMapper.selectByDeptId(deptId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<Map<String, Object>> selectEntNameByDeptId(Integer deptId) {
|
|
|
|
+ return wmDaDrugEntMapper.selectEntNameByDeptId(deptId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List selectEntNameByByDeptIds(Integer upId) {
|
|
|
|
+ return wmDaDrugEntMapper.selectEntNameByByDeptIds(upId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<WmDaDrugEnt> getListByCsoDeptId(Integer deptId) {
|
|
|
|
+ return wmDaDrugEntMapper.getListByCsoDeptId(deptId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 分页查询
|
|
|
|
+ *
|
|
|
|
+ * @param page 分页对象
|
|
|
|
+ * @param wmDaDrugEnt 实体对象
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public void selectPage(Page<WmDaDrugEnt> page, WmDaDrugEnt wmDaDrugEnt) {
|
|
|
|
+
|
|
|
|
+ List<Long> areas;
|
|
|
|
+ if (CollUtil.isNotEmpty(wmDaDrugEnt.getAreaCodes())) {
|
|
|
|
+ areas = wmDaDrugEnt.getAreaCodes();
|
|
|
|
+ } else {
|
|
|
|
+ areas = sysUserAreaService.listUserAreas(Long.valueOf(SecurityUtils.getUser().getId()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<Long> ents = enterpriseAreaService.listAreaEnts(areas);
|
|
|
|
+ wmDaDrugEnt.setEntIds(ents);
|
|
|
|
+ wmDaDrugEntMapper.selectPage(page, wmDaDrugEnt);
|
|
|
|
+ page.getRecords().forEach(ent -> {
|
|
|
|
+ List<Long> areaCodes = enterpriseAreaService.listEntAreas(Collections.singletonList(Long.valueOf(ent.getDeptId())));
|
|
|
|
+ ent.setAreaCodes(areaCodes);
|
|
|
|
+ ;
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|