diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/pom.xml b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/pom.xml index cea8e19d..5f8904a4 100644 --- a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/pom.xml +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/pom.xml @@ -23,6 +23,11 @@ epdc-news-client 1.0.0 + + com.esua.epdc + epdc-user-client + 1.0.0 + diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/EnterpriseReportDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/EnterpriseReportDTO.java new file mode 100644 index 00000000..0278aea1 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/EnterpriseReportDTO.java @@ -0,0 +1,177 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 企业信息上报 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-08-02 + */ +@Data +public class EnterpriseReportDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 企业所属网格 + */ + private String grid; + + /** + * 企业所属网格ID + */ + private Long gridId; + + /** + * 发布人所属网格 + */ + private String dept; + + /** + * 发布人所属网格ID + */ + private Long deptId; + + /** + * 发布人ID + */ + private String userId; + + /** + * 发布人手机号 + */ + private String mobile; + + /** + * 发布人头像 + */ + private String faceImg; + + /** + * 发布人真实姓名 + */ + private String realName; + + /** + * 所属年度 + */ + private String year; + + /** + * 所属季度 + */ + private String quarter; + + /** + * 公司名称 + */ + private String enterpriseName; + + /** + * 法人或联络人 + */ + private String legalPerson; + + /** + * 联系电话 + */ + private String concat; + + /** + * 公司状态 + */ + private String enterpriseStatus; + + /** + * 营业收入 + */ + private BigDecimal enterpriseIncome; + + /** + * 用工人数 + */ + private Integer enterprisePeopleNum; + + /** + * 问题 + */ + private String question; + + /** + * 删除标识 0:未删除,1:已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 企业父所有部门 + */ + private String parentDeptIds; + + /** + * 企业父所有部门 + */ + private String parentDeptNames; + + /** + * 企业所有部门ID + */ + private String allDeptIds; + + /** + * 企业所有部门名称 + */ + private String allDeptNames; + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/EnterpriseReportAddFormDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/EnterpriseReportAddFormDTO.java new file mode 100644 index 00000000..5360dca7 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/EnterpriseReportAddFormDTO.java @@ -0,0 +1,73 @@ +package com.elink.esua.epdc.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * + * + * @author songyunpeng + * @since v1.0.0 2020-05-20 + */ +@Data +public class EnterpriseReportAddFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + /** + * 企业所属网格ID + */ + @NotBlank(message = "企业所属网格ID不能为空") + private String gridId; + + /** + * 所属年度 + */ + @NotBlank(message = "所属年度不能为空") + private String year; + + /** + * 所属季度 + */ + @NotBlank(message = "所属季度不能为空") + private String quarter; + + /** + * 公司名称 + */ + @NotBlank(message = "公司名称不能为空") + private String enterpriseName; + + /** + * 法人或联络人 + */ + @NotBlank(message = " 法人或联络人不能为空") + private String legalPerson; + + /** + * 联系电话 + */ + private String concat; + + /** + * 公司状态 + */ + private String enterpriseStatus; + + /** + * 营业收入 + */ + private BigDecimal enterpriseIncome; + + /** + * 用工人数 + */ + private Integer enterprisePeopleNum; + + /** + * 问题 + */ + private String question; +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/EnterpriseReportFormDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/EnterpriseReportFormDTO.java new file mode 100644 index 00000000..69e5c4d0 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/EnterpriseReportFormDTO.java @@ -0,0 +1,33 @@ +package com.elink.esua.epdc.dto.form; + +import lombok.Data; + +import javax.validation.constraints.Min; +import java.io.Serializable; + +/** + * + * + * @author songyunpeng + * @since v1.0.0 2020-05-20 + */ +@Data +public class EnterpriseReportFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 页码 + */ + @Min(value = 1, message = "页码必须大于0") + private Integer pageIndex; + + /** + * 页容量 + */ + @Min(value = 1, message = "页容量必须大于0") + private Integer pageSize; + + private Long userId; + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/EpdcAddGroupBuyInfoFormDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/EpdcAddGroupBuyInfoFormDTO.java index 77910054..6ddc1ca0 100644 --- a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/EpdcAddGroupBuyInfoFormDTO.java +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/EpdcAddGroupBuyInfoFormDTO.java @@ -69,12 +69,12 @@ public class EpdcAddGroupBuyInfoFormDTO implements Serializable { * 团购价格人数(最多五条) */ @NotNull(message = "团购价格人数不能为空") - List groupBuyPriceNumber; + private List groupBuyPriceNumber; /** * 团购图片(最多三张) */ - List groupBuyImg; + private List groupBuyImg; /** * 截止时间 diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/controller/EnterpriseReportController.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/controller/EnterpriseReportController.java new file mode 100644 index 00000000..82e7e0aa --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/controller/EnterpriseReportController.java @@ -0,0 +1,119 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.enterprisereport.controller; + +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.commons.tools.validator.AssertUtils; +import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; +import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; +import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; +import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; +import com.elink.esua.epdc.dto.EnterpriseReportDTO; +import com.elink.esua.epdc.dto.form.EnterpriseReportAddFormDTO; +import com.elink.esua.epdc.dto.form.EnterpriseReportFormDTO; +import com.elink.esua.epdc.modules.enterprisereport.excel.EnterpriseReportExcel; +import com.elink.esua.epdc.modules.enterprisereport.service.EnterpriseReportService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 企业信息上报 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-08-02 + */ +@RestController +@RequestMapping("enterprisereport") +public class EnterpriseReportController { + + @Autowired + private EnterpriseReportService enterpriseReportService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = enterpriseReportService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + EnterpriseReportDTO data = enterpriseReportService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody EnterpriseReportDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + enterpriseReportService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody EnterpriseReportDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + enterpriseReportService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + enterpriseReportService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = enterpriseReportService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, EnterpriseReportExcel.class); + } + + /** + * @Description 小程序获取企业上报列表 + * @Author songyunpeng + * @Date 2021/8/2 + * @Param [] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + @GetMapping("/getEnterpriseReportList") + public Result> getEnterpriseReportList(EnterpriseReportFormDTO enterpriseReportFormDTO){ + return enterpriseReportService.getEnterpriseReportList(enterpriseReportFormDTO); + } + /** + * @Description 新增企业上报 + * @Author songyunpeng + * @Date 2021/8/2 + * @Param [enterpriseReportAddFormDTO] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + @PostMapping("/addEnterpriseReport") + public Result addEnterpriseReport(@RequestBody EnterpriseReportAddFormDTO enterpriseReportAddFormDTO){ + return enterpriseReportService.addEnterpriseReport(enterpriseReportAddFormDTO); + } + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/dao/EnterpriseReportDao.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/dao/EnterpriseReportDao.java new file mode 100644 index 00000000..19d94241 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/dao/EnterpriseReportDao.java @@ -0,0 +1,44 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.enterprisereport.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.dto.EnterpriseReportDTO; +import com.elink.esua.epdc.dto.form.EnterpriseReportFormDTO; +import com.elink.esua.epdc.modules.enterprisereport.entity.EnterpriseReportEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 企业信息上报 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-08-02 + */ +@Mapper +public interface EnterpriseReportDao extends BaseDao { + /** + * @Description 企业上报列表 + * @Author songyunpeng + * @Date 2021/8/2 + * @Param [formDTO] + * @return java.util.List + **/ + List getEnterpriseReportList(EnterpriseReportFormDTO formDTO); +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/entity/EnterpriseReportEntity.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/entity/EnterpriseReportEntity.java new file mode 100644 index 00000000..fcdbc37d --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/entity/EnterpriseReportEntity.java @@ -0,0 +1,145 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.enterprisereport.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 企业信息上报 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-08-02 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_enterprise_report") +public class EnterpriseReportEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 企业所属网格 + */ + private String grid; + + /** + * 企业所属网格ID + */ + private Long gridId; + + /** + * 发布人所属网格 + */ + private String dept; + + /** + * 发布人所属网格ID + */ + private Long deptId; + + /** + * 发布人ID + */ + private String userId; + + /** + * 发布人手机号 + */ + private String mobile; + + /** + * 发布人头像 + */ + private String faceImg; + + /** + * 发布人真实姓名 + */ + private String realName; + + /** + * 所属年度 + */ + private String year; + + /** + * 所属季度 + */ + private String quarter; + + /** + * 公司名称 + */ + private String enterpriseName; + + /** + * 法人或联络人 + */ + private String legalPerson; + + /** + * 联系电话 + */ + private String concat; + + /** + * 公司状态 + */ + private String enterpriseStatus; + + /** + * 营业收入 + */ + private BigDecimal enterpriseIncome; + + /** + * 用工人数 + */ + private Integer enterprisePeopleNum; + + /** + * 问题 + */ + private String question; + + /** + * 企业父所有部门 + */ + private String parentDeptIds; + + /** + * 企业父所有部门 + */ + private String parentDeptNames; + + /** + * 企业所有部门ID + */ + private String allDeptIds; + + /** + * 企业所有部门名称 + */ + private String allDeptNames; + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/excel/EnterpriseReportExcel.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/excel/EnterpriseReportExcel.java new file mode 100644 index 00000000..8ecc065e --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/excel/EnterpriseReportExcel.java @@ -0,0 +1,123 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.enterprisereport.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 企业信息上报 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-08-02 + */ +@Data +public class EnterpriseReportExcel { + + @Excel(name = "ID") + private String id; + + @Excel(name = "企业所属网格") + private Long grid; + + @Excel(name = "企业所属网格ID") + private String gridId; + + @Excel(name = "发布人所属网格") + private Long dept; + + @Excel(name = "发布人所属网格ID") + private String deptId; + + @Excel(name = "发布人ID") + private String userId; + + @Excel(name = "发布人昵称") + private String nickname; + + @Excel(name = "发布人手机号") + private String mobile; + + @Excel(name = "发布人头像") + private String faceImg; + + @Excel(name = "发布人真实姓名") + private String realName; + + @Excel(name = "所属年度") + private String year; + + @Excel(name = "所属季度") + private String quarter; + + @Excel(name = "公司名称") + private String enterpriseName; + + @Excel(name = "法人或联络人") + private String legalPerson; + + @Excel(name = "联系电话") + private String concat; + + @Excel(name = "公司状态") + private String enterpriseStatus; + + @Excel(name = "营业收入") + private BigDecimal enterpriseIncome; + + @Excel(name = "用工人数") + private Integer enterprisePeopleNum; + + @Excel(name = "问题") + private String question; + + @Excel(name = "删除标识 0:未删除,1:已删除") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + @Excel(name = "企业父所有部门") + private String parentDeptIds; + + @Excel(name = "企业父所有部门") + private String parentDeptNames; + + @Excel(name = "企业所有部门ID") + private String allDeptIds; + + @Excel(name = "企业所有部门名称") + private String allDeptNames; + + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/redis/EnterpriseReportRedis.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/redis/EnterpriseReportRedis.java new file mode 100644 index 00000000..dc616b28 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/redis/EnterpriseReportRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.enterprisereport.redis; + +import com.elink.esua.epdc.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 企业信息上报 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-08-02 + */ +@Component +public class EnterpriseReportRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/service/EnterpriseReportService.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/service/EnterpriseReportService.java new file mode 100644 index 00000000..82590652 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/service/EnterpriseReportService.java @@ -0,0 +1,114 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.enterprisereport.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.EnterpriseReportDTO; +import com.elink.esua.epdc.dto.form.EnterpriseReportAddFormDTO; +import com.elink.esua.epdc.dto.form.EnterpriseReportFormDTO; +import com.elink.esua.epdc.modules.enterprisereport.entity.EnterpriseReportEntity; + +import java.util.List; +import java.util.Map; + +/** + * 企业信息上报 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-08-02 + */ +public interface EnterpriseReportService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-08-02 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-08-02 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return EnterpriseReportDTO + * @author generator + * @date 2021-08-02 + */ + EnterpriseReportDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-08-02 + */ + void save(EnterpriseReportDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-08-02 + */ + void update(EnterpriseReportDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-08-02 + */ + void delete(String[] ids); + /** + * @Description 小程序获取企业上报列表 + * @Author songyunpeng + * @Date 2021/8/2 + * @Param [] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + Result> getEnterpriseReportList(EnterpriseReportFormDTO enterpriseReportFormDTO); + /** + * @Description 新增企业上报 + * @Author songyunpeng + * @Date 2021/8/2 + * @Param [enterpriseReportAddFormDTO] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + Result addEnterpriseReport(EnterpriseReportAddFormDTO enterpriseReportAddFormDTO); +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/service/impl/EnterpriseReportServiceImpl.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/service/impl/EnterpriseReportServiceImpl.java new file mode 100644 index 00000000..a829eb6e --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/enterprisereport/service/impl/EnterpriseReportServiceImpl.java @@ -0,0 +1,169 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.enterprisereport.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; +import com.elink.esua.epdc.commons.tools.constant.FieldConstant; +import com.elink.esua.epdc.commons.tools.constant.NumConstant; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.security.user.SecurityUser; +import com.elink.esua.epdc.commons.tools.security.user.UserDetail; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.EnterpriseReportDTO; +import com.elink.esua.epdc.dto.form.EnterpriseReportAddFormDTO; +import com.elink.esua.epdc.dto.form.EnterpriseReportFormDTO; +import com.elink.esua.epdc.modules.enterprisereport.dao.EnterpriseReportDao; +import com.elink.esua.epdc.modules.enterprisereport.entity.EnterpriseReportEntity; +import com.elink.esua.epdc.modules.enterprisereport.service.EnterpriseReportService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 企业信息上报 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-08-02 + */ +@Service +public class EnterpriseReportServiceImpl extends BaseServiceImpl implements EnterpriseReportService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, EnterpriseReportDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, EnterpriseReportDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String gridId = (String)params.get("GRID_ID"); + String year = (String)params.get("YEAR"); + String quarter = (String)params.get("QUARTER"); + String enterpriseName = (String)params.get("ENTERPRISE_NAME"); + String legalPerson = (String)params.get("LEGAL_PERSON"); + String concat = (String)params.get("CONCAT"); + String enterpriseStatus = (String)params.get("ENTERPRISE_STATUS"); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(gridId), "GRID_ID", gridId); + wrapper.eq(StringUtils.isNotBlank(year), "YEAR", year); + wrapper.eq(StringUtils.isNotBlank(quarter), "QUARTER", quarter); + wrapper.like(StringUtils.isNotBlank(enterpriseName), "ENTERPRISE_NAME", enterpriseName); + wrapper.like(StringUtils.isNotBlank(legalPerson), "LEGAL_PERSON", legalPerson); + wrapper.like(StringUtils.isNotBlank(concat), "CONCAT", concat); + wrapper.eq(StringUtils.isNotBlank(enterpriseStatus), "ENTERPRISE_STATUS", enterpriseStatus); + + return wrapper; + } + + @Override + public EnterpriseReportDTO get(String id) { + EnterpriseReportEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, EnterpriseReportDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(EnterpriseReportDTO dto) { + EnterpriseReportEntity entity = ConvertUtils.sourceToTarget(dto, EnterpriseReportEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(EnterpriseReportDTO dto) { + EnterpriseReportEntity entity = ConvertUtils.sourceToTarget(dto, EnterpriseReportEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public Result> getEnterpriseReportList(EnterpriseReportFormDTO formDTO) { + Long userId = SecurityUser.getUserId(); + if(userId == null){ + return new Result>().error("无法获取到用户ID"); + } + formDTO.setUserId(userId); + int pageIndex = (formDTO.getPageIndex() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setPageIndex(pageIndex); + + List list = this.baseDao.getEnterpriseReportList(formDTO); + return new Result().ok(list); + } + + @Override + public Result addEnterpriseReport(EnterpriseReportAddFormDTO enterpriseReportAddFormDTO) { + UserDetail user = SecurityUser.getUser(); + if(user == null){ + return new Result>().error("无法获取到用户"); + } + QueryWrapper entityQueryWrapper =new QueryWrapper<>(); + entityQueryWrapper.eq("YEAR",enterpriseReportAddFormDTO.getYear()); + entityQueryWrapper.eq("QUARTER",enterpriseReportAddFormDTO.getQuarter()); + entityQueryWrapper.eq("ENTERPRISE_NAME",enterpriseReportAddFormDTO.getEnterpriseName()); + EnterpriseReportEntity enterpriseReportEntity = new EnterpriseReportEntity(); + enterpriseReportEntity.setDept(user.getDeptName()); + enterpriseReportEntity.setDeptId(user.getDeptId()); + enterpriseReportEntity.setMobile(user.getMobile()); + enterpriseReportEntity.setRealName(user.getRealName()); + enterpriseReportEntity.setFaceImg(user.getHeadUrl()); + enterpriseReportEntity.setYear(enterpriseReportAddFormDTO.getYear()); + enterpriseReportEntity.setQuarter(enterpriseReportAddFormDTO.getQuarter()); + enterpriseReportEntity.setEnterpriseName(enterpriseReportAddFormDTO.getEnterpriseName()); + enterpriseReportEntity.setLegalPerson(enterpriseReportAddFormDTO.getLegalPerson()); + enterpriseReportEntity.setConcat(enterpriseReportAddFormDTO.getConcat()); + enterpriseReportEntity.setEnterpriseStatus(enterpriseReportAddFormDTO.getEnterpriseStatus()); + enterpriseReportEntity.setEnterpriseIncome(enterpriseReportAddFormDTO.getEnterpriseIncome()); + enterpriseReportEntity.setEnterprisePeopleNum(enterpriseReportAddFormDTO.getEnterprisePeopleNum()); + enterpriseReportEntity.setQuestion(enterpriseReportAddFormDTO.getQuestion()); + //校验唯一性 + List enterpriseReportEntities = baseDao.selectList(entityQueryWrapper); + if(enterpriseReportEntities.size()>1){ + enterpriseReportEntity.setId(enterpriseReportEntities.get(0).getId()); + baseDao.updateById(enterpriseReportEntity); + return new Result(); + } + insert(enterpriseReportEntity); + return new Result(); + } + + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/enterprisereport/EnterpriseReportDao.xml b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/enterprisereport/EnterpriseReportDao.xml new file mode 100644 index 00000000..de94cc9d --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/enterprisereport/EnterpriseReportDao.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +