diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java index 23e04e4f9a..ab79c52b24 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java @@ -124,29 +124,35 @@ public class LoginServiceImpl implements LoginService { * @since 2020/3/14 19:34 */ private String getUserId(LoginByWxCodeFormDTO formDTO, WxMaJscode2SessionResult wxMaJscode2SessionResult) { - WxLoginUserInfoFormDTO wxLoginUserInfoFormDTO=new WxLoginUserInfoFormDTO(); + WxLoginUserInfoFormDTO wxLoginUserInfoFormDTO = new WxLoginUserInfoFormDTO(); wxLoginUserInfoFormDTO.setApp(formDTO.getApp()); wxLoginUserInfoFormDTO.setOpenId(wxMaJscode2SessionResult.getOpenid()); - Result userResult=epmetUserFeignClient.selecWxLoginUserInfo(wxLoginUserInfoFormDTO); - String userId=""; - if(!userResult.success()){ - throw new RenException("获取用户信息失败"+userResult.getMsg()); + Result userResult = epmetUserFeignClient.selecWxLoginUserInfo(wxLoginUserInfoFormDTO); + String userId = ""; + if (!userResult.success()) { + throw new RenException("获取用户信息失败" + userResult.getMsg()); } - userId= (String) userResult.getData(); - if (StringUtils.isBlank(userId)&&LoginConstant.APP_GOV.equals(formDTO.getApp())) { + userId = (String) userResult.getData(); + if (StringUtils.isBlank(userId) && LoginConstant.APP_GOV.equals(formDTO.getApp())) { //查询customer_staff待完善 - } else if (StringUtils.isBlank(userId)&&LoginConstant.APP_OPER.equals(formDTO.getApp())) { + } else if (StringUtils.isBlank(userId) && LoginConstant.APP_OPER.equals(formDTO.getApp())) { //查询oper_user待完善 - } else if (StringUtils.isBlank(userId)&&LoginConstant.APP_RESI.equals(formDTO.getApp())) { + } else if (StringUtils.isBlank(userId) && LoginConstant.APP_RESI.equals(formDTO.getApp())) { //查询customer_user - WxMaUserInfo wxMaUserInfo = wxMaServiceUtils.resiWxMaService().getUserService() - .getUserInfo(wxMaJscode2SessionResult.getSessionKey(), - formDTO.getEncryptedData(), - formDTO.getIv()); - CustomerUserDTO customerUserDTO=this.packageCustomerUserDTO(wxMaUserInfo); - Result saveCustomerUserResult=epmetUserFeignClient.saveCustomerUser(customerUserDTO); - if(!saveCustomerUserResult.success()){ - throw new RenException("创建用户失败"+userResult.getMsg()); + CustomerUserDTO customerUserDTO = new CustomerUserDTO(); + if (StringUtils.isNotBlank(formDTO.getIv()) && StringUtils.isNotBlank(formDTO.getEncryptedData())) { + WxMaUserInfo wxMaUserInfo = wxMaServiceUtils.resiWxMaService().getUserService() + .getUserInfo(wxMaJscode2SessionResult.getSessionKey(), + formDTO.getEncryptedData(), + formDTO.getIv()); + customerUserDTO = this.packageCustomerUserDTO(wxMaUserInfo); + } else { + customerUserDTO.setWxOpenId(wxMaJscode2SessionResult.getOpenid()); + customerUserDTO.setUnionId(wxMaJscode2SessionResult.getUnionid()); + } + Result saveCustomerUserResult = epmetUserFeignClient.saveCustomerUser(customerUserDTO); + if (!saveCustomerUserResult.success()) { + throw new RenException("创建用户失败" + userResult.getMsg()); } userId = saveCustomerUserResult.getData(); } @@ -222,22 +228,22 @@ public class LoginServiceImpl implements LoginService { public Result loginByPassword(LoginByPassWordFormDTO formDTO) { //1、验证码是否正确 boolean flag = captchaService.validate(formDTO.getUuid(), formDTO.getCaptcha()); - if(!flag){ + if (!flag) { return new Result().error(ErrorCode.CAPTCHA_ERROR); } //2、账号是否存在 //获取用户信息 - PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO=new PasswordLoginUserInfoFormDTO(); + PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO = new PasswordLoginUserInfoFormDTO(); passwordLoginUserInfoFormDTO.setApp(formDTO.getApp()); passwordLoginUserInfoFormDTO.setPhone(formDTO.getPhone()); - Result userInfoResult=epmetUserFeignClient.selectLoginUserInfoByPassword(passwordLoginUserInfoFormDTO); - logger.info(userInfoResult.getCode()+userInfoResult.getMsg()); - if(!userInfoResult.success()||null==userInfoResult.getData()){ + Result userInfoResult = epmetUserFeignClient.selectLoginUserInfoByPassword(passwordLoginUserInfoFormDTO); + logger.info(userInfoResult.getCode() + userInfoResult.getMsg()); + if (!userInfoResult.success() || null == userInfoResult.getData()) { return new Result().error("账号不存在"); } //3、密码是否正确 //密码错误 - if(!PasswordUtils.matches(formDTO.getPassword(),userInfoResult.getData().getPassWord())){ + if (!PasswordUtils.matches(formDTO.getPassword(), userInfoResult.getData().getPassWord())) { throw new RenException(ErrorCode.ACCOUNT_PASSWORD_ERROR); } //4、生成token返回,且将TokenDto存到redis diff --git a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/dto/form/LoginByWxCodeFormDTO.java b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/dto/form/LoginByWxCodeFormDTO.java index 149514a0a3..0f61c36255 100644 --- a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/dto/form/LoginByWxCodeFormDTO.java +++ b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/dto/form/LoginByWxCodeFormDTO.java @@ -23,12 +23,10 @@ public class LoginByWxCodeFormDTO extends LoginCommonFormDTO implements Serializ /** * 用户信息 */ - @NotBlank(message = "用户信息不能为空") private String encryptedData; /** * 加密算法的初始向量 */ - @NotBlank(message = "初始向量不能为空") private String iv; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java index 232c92ac97..c358b530b3 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java @@ -50,7 +50,7 @@ public interface ServiceConstant { String RESI_GUIDE_SERVER = "resi-guide-server"; /** - * 政府机构组织管理 + * 政府端组织架构 */ String GOV_ORG_SERVER = "gov-org-server"; } diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 5ae326d135..8acbdd9bf6 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -143,7 +143,7 @@ http://127.0.0.1:8091 - + http://127.0.0.1:8092 @@ -196,8 +196,8 @@ lb://oper-crm-server - lb://resi-guid-server - + lb://resi-guide-server + lb://gov-org-server lb://oper-access-server diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 2a9212f469..51623f62d0 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -127,6 +127,7 @@ spring: - Path=${server.servlet.context-path}/resi/guide/** filters: - StripPrefix=1 + - CpAuth=true #政府端组织管理 - id: gov-org-server uri: @gateway.routes.gov-org-server.uri@ @@ -240,6 +241,7 @@ epmet: - /epmetuser/** - /gov/org/** - /oper/access/** + - /resi/guide/** swaggerUrls: jwt: diff --git a/epmet-module/epmet-demo/epmet-demo-server/pom.xml b/epmet-module/epmet-demo/epmet-demo-server/pom.xml index 40fa935c52..94c098a1b6 100644 --- a/epmet-module/epmet-demo/epmet-demo-server/pom.xml +++ b/epmet-module/epmet-demo/epmet-demo-server/pom.xml @@ -67,6 +67,11 @@ 2.0.0 compile + + com.epmet + epmet-user-server + 2.0.0 + diff --git a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/controller/DemoController.java index 2588109776..0e6ecfe1bc 100644 --- a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/controller/DemoController.java @@ -180,4 +180,5 @@ public class DemoController { public Result getSysUserInfoById(@RequestParam("id") Long id) { return demoService.getSysUserInfoById(id); } + } diff --git a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java index e2d1a6ac26..de3a3191d6 100644 --- a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java +++ b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -17,4 +17,5 @@ import org.springframework.web.bind.annotation.PathVariable; public interface GovOrgFeignClient { @GetMapping("gov/org/customergrid/getcustomergrid/{id}") Result getcustomergrid(@PathVariable("id") String id); + } diff --git a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java index f1540af47a..70e5f2e1cb 100644 --- a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java +++ b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java @@ -14,8 +14,8 @@ import org.springframework.stereotype.Component; */ @Component public class GovOrgFeignClientFallBack implements GovOrgFeignClient { - @Override - public Result getcustomergrid(String id) { - return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getcustomergrid",id); - } -} + @Override + public Result getcustomergrid(String id) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getcustomergrid",id); + } +} \ No newline at end of file diff --git a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/service/DemoService.java b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/service/DemoService.java index 38cfe6ef29..612f736267 100644 --- a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/service/DemoService.java +++ b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/service/DemoService.java @@ -154,4 +154,5 @@ public interface DemoService extends BaseService { * @Date 2020/3/20 9:37 **/ Result getSysUserInfoById(Long id); + } diff --git a/epmet-module/epmet-message/pom.xml b/epmet-module/epmet-message/pom.xml index 6238a8b4d1..9610fd3def 100644 --- a/epmet-module/epmet-message/pom.xml +++ b/epmet-module/epmet-message/pom.xml @@ -4,10 +4,10 @@ 4.0.0 - com.epmet - epmet-module - 2.0.0 - + com.epmet + epmet-module + 2.0.0 + com.epmet epmet-message diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/PdmanDbVersionDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerGridFormDTO.java similarity index 72% rename from epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/PdmanDbVersionDTO.java rename to epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerGridFormDTO.java index 7b6008323b..c3c237e83a 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/PdmanDbVersionDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerGridFormDTO.java @@ -15,37 +15,28 @@ * along with this program. If not, see . */ -package com.epmet.dto; +package com.epmet.dto.form; -import java.io.Serializable; -import java.util.Date; import lombok.Data; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + /** - * - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-03-16 + * epmet-user端调用gov-org端的入参 + * @author sun */ @Data -public class PdmanDbVersionDTO implements Serializable { +public class CustomerGridFormDTO implements Serializable { private static final long serialVersionUID = 1L; /** - * - */ - private String dbVersion; - - /** - * + * 网格Id */ - private String versionDesc; + @NotBlank(message = "网格ID不能为空") + private String gridId; - /** - * - */ - private String createdTime; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListCustomerGridFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListCustomerGridFormDTO.java new file mode 100644 index 0000000000..78aa62fd80 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListCustomerGridFormDTO.java @@ -0,0 +1,38 @@ +package com.epmet.dto.form;/** + * Created by 11 on 2020/3/19. + */ + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 陌生人导览查询附近网格传参定义 + * @ClassName ListCustomerGridFormDTO + * @Author wangc + * @date 2020.03.19 15:00 + */ +@Data +public class ListCustomerGridFormDTO implements Serializable{ + + private static final long serialVersionUID = -1L; + + /** + * 地区编码(城市、区县) + * */ + @NotBlank(message = "地区码不能为空") + private String areaCode; + + /** + * 当前页 + * */ + @Min(value = 1) + private Integer pageNo; + + /** + * 每页显示数量 + * */ + private Integer pageSize = 20; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridForStrangerResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridForStrangerResultDTO.java new file mode 100644 index 0000000000..465db64595 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridForStrangerResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 陌生人搜索网格返回结果 + * @ClassName CustomerGridForStrangerResultDTO + * @Author wangc + * @date 2020.03.19 00:38 + */ +@Data +public class CustomerGridForStrangerResultDTO implements Serializable { + private static final long serialVersionUID = -1L; + + /** + * 网格ID + * */ + private String gridId; + + /** + * 客户ID + * */ + private String customerId; + + /** + * 网格名称 + * */ + private String gridName; +} diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml index dbdded2ad2..066e5ecb0f 100644 --- a/epmet-module/gov-org/gov-org-server/pom.xml +++ b/epmet-module/gov-org/gov-org-server/pom.xml @@ -54,6 +54,13 @@ feign-httpclient 10.3.0 + + + + com.epmet + gov-org-client + 2.0.0 + diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java index 9e8eed6436..fec741f5e4 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java @@ -26,6 +26,9 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.dto.result.CustomerGridForStrangerResultDTO; +import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.excel.CustomerGridExcel; import com.epmet.service.CustomerGridService; import org.springframework.beans.factory.annotation.Autowired; @@ -91,6 +94,31 @@ public class CustomerGridController { ExcelUtils.exportExcelToTarget(response, null, list, CustomerGridExcel.class); } + /** + * 供epmet-user服务调用 查询客户网格表数据 + * @author sun + * @param formDTO + * @return + * @throws Exception + */ + @PostMapping("getcustomergridbygridid") + public Result getCustomerGridByGridId(@RequestBody CustomerGridFormDTO formDTO) { + return customerGridService.getCustomerGridByGridId(formDTO); + } + /** + * @Description 陌生人导览模块调用 根据陌生揽客传入的地区码进行分页查询显示 + * @Param ListCustomerGridFormDTO + * @return Result> + * @Author wangc + * @Date 2020.03.19 15:23 + **/ + @PostMapping("queryListForStrangerByOrder") + public Result> queryListForStrangerByOrder(@RequestBody ListCustomerGridFormDTO listCustomerGridFormDTO ){ + + ValidatorUtils.validateEntity(listCustomerGridFormDTO); + return customerGridService.listGridForStrangerByOrder(listCustomerGridFormDTO); + } + @GetMapping("getcustomergrid/{id}") public Result getcustomergrid(@PathVariable("id") String id){ CustomerGridDTO data = customerGridService.get(id); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index f13389578a..41951995ff 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -18,8 +18,16 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.dto.result.CustomerGridForStrangerResultDTO; +import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.entity.CustomerGridEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; /** * 客户网格表 @@ -29,5 +37,36 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CustomerGridDao extends BaseDao { - + + + /** + * @Description 查特定区的网格 + * @Param areaCode + * @return CustomerGridForStrangerResultDTO + * @Author wangc + * @Date 2020.03.19 15:53 + **/ + List selectGridByAreaCode(@Param("areaCode")String areaCode); + + /** + * @Description 查整个城市的网格 + * @Param areaCode + * @return CustomerGridForStrangerResultDTO + * @Author wangc + * @Date 2020.03.19 15:53 + **/ + List selectGridByCityLike(ListCustomerGridFormDTO listCustomerGridFormDTO); + + + /** + * @Description 指定区时查询当前城市下除该区之外其余的网格 + * @Param areaCode + * @Param cityCode + * @return CustomerGridForStrangerResultDTO + * @Author wangc + * @Date 2020.03.19 15:53 + **/ + List selectRestGridWithoutGivenAreaCode(Map paramsMap); + + CustomerGridDTO getCustomerGridByGridId(CustomerGridFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/exception/ModuleErrorCode.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/exception/ModuleErrorCode.java new file mode 100644 index 0000000000..dc2e3e93cc --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/exception/ModuleErrorCode.java @@ -0,0 +1,20 @@ +package com.epmet.exception; + +import com.epmet.commons.tools.exception.ErrorCode; + +/** + * 模块错误编码,由9位数字组成,前6位为模块编码,后3位为业务编码 + *

+ * 如:100001001(100001代表模块,001代表业务代码) + *

+ * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +public interface ModuleErrorCode extends ErrorCode { + + int ARGS_NOT_ALLOW_NULL_ERROR = 100019001; + + int NOT_STANDARD_AREA_CODE_ERROR = 100019002; + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java index cdc050da2c..ceb317d455 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java @@ -19,7 +19,11 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.entity.CustomerGridEntity; import java.util.List; @@ -92,4 +96,21 @@ public interface CustomerGridService extends BaseService { * @date 2020-03-16 */ void delete(String[] ids); + + /** + * 陌生人查询附近网格数据 + * 不管传递的areaCode是市级还是县级,都查询整个城市的网格信息,需要特定的排序 + * @param + * @return Result> + * @author wangc + * @date 2020-03-16 + * */ + Result> listGridForStrangerByOrder(ListCustomerGridFormDTO listCustomerGridFormDTO); + + /** 根据网格Id查询用户数据 + * @param formDTO + * @return + * @date 2020-03-17 + */ + Result getCustomerGridByGridId(CustomerGridFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index 2058bf4d79..d94eb029cf 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -23,9 +23,14 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.Result; import com.epmet.dao.CustomerGridDao; import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.entity.CustomerGridEntity; + import com.epmet.redis.CustomerGridRedis; import com.epmet.service.CustomerGridService; import org.apache.commons.lang3.StringUtils; @@ -34,11 +39,12 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; /** - * 客户网格表 + * 客户网格表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-16 @@ -101,4 +107,48 @@ public class CustomerGridServiceImpl extends BaseServiceImpl> listGridForStrangerByOrder(ListCustomerGridFormDTO listCustomerGridFormDTO) { + + Result> result = new Result<>(); + + + String areaCode = listCustomerGridFormDTO.getAreaCode(); + listCustomerGridFormDTO.setPageNo((listCustomerGridFormDTO.getPageNo() - 1) * listCustomerGridFormDTO.getPageSize()); + + if(areaCode.endsWith("00")){ + //城市 - 查全部 + listCustomerGridFormDTO.setAreaCode(areaCode.substring(0,areaCode.length()-2)); + List gridList + = baseDao.selectGridByCityLike(listCustomerGridFormDTO); + + result.setData(gridList); + result.setCode(0); + return result; + }else{ + //行政区 + + Map map = new HashMap<>(); + + map.put("areaCode",areaCode); + map.put("cityCode",areaCode.substring(0,areaCode.length()-2)); + map.put("pageSize",listCustomerGridFormDTO.getPageSize()); + map.put("pageNo",listCustomerGridFormDTO.getPageNo()); + + List gridListArea + = baseDao.selectRestGridWithoutGivenAreaCode(map); + + result.setData(gridListArea); + + return result; + + } + + } + + @Override + public Result getCustomerGridByGridId(CustomerGridFormDTO formDTO) { + return new Result().ok(baseDao.getCustomerGridByGridId(formDTO)); + } + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PdmanDbVersionServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PdmanDbVersionServiceImpl.java deleted file mode 100644 index 59143774d9..0000000000 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PdmanDbVersionServiceImpl.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * 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.epmet.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; -import com.epmet.dao.PdmanDbVersionDao; -import com.epmet.dto.PdmanDbVersionDTO; -import com.epmet.entity.PdmanDbVersionEntity; -import com.epmet.redis.PdmanDbVersionRedis; -import com.epmet.service.PdmanDbVersionService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -/** - * - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-03-16 - */ -@Service -public class PdmanDbVersionServiceImpl extends BaseServiceImpl implements PdmanDbVersionService { - - @Autowired - private PdmanDbVersionRedis pdmanDbVersionRedis; - - @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, PdmanDbVersionDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, PdmanDbVersionDTO.class); - } - - private QueryWrapper getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); - - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); - - return wrapper; - } - - @Override - public PdmanDbVersionDTO get(String id) { - PdmanDbVersionEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, PdmanDbVersionDTO.class); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void save(PdmanDbVersionDTO dto) { - PdmanDbVersionEntity entity = ConvertUtils.sourceToTarget(dto, PdmanDbVersionEntity.class); - insert(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(PdmanDbVersionDTO dto) { - PdmanDbVersionEntity entity = ConvertUtils.sourceToTarget(dto, PdmanDbVersionEntity.class); - updateById(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); - } - -} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index 5765fffd44..c18e744373 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -22,5 +22,107 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/PdmanDbVersionDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/PdmanDbVersionDao.xml deleted file mode 100644 index f265a47684..0000000000 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/PdmanDbVersionDao.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerHomeDetailDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerHomeDetailDTO.java index 79fdf9ae05..82f5b1d9ce 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerHomeDetailDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerHomeDetailDTO.java @@ -23,7 +23,7 @@ import lombok.Data; /** - * 客户首页详情表 + * 客户首页详情表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-10 @@ -49,9 +49,9 @@ public class CustomerHomeDetailDTO implements Serializable { private String componentId; /** - * 所属区域:0.标题区、1.置顶区、2.功能区、3.悬浮区 + * 所属区域:titleList.标题区、topList.置顶区、functionList.功能区、floatingList.悬浮区 */ - private Integer region; + private String region; /** * 高级配置 @@ -93,4 +93,4 @@ public class CustomerHomeDetailDTO implements Serializable { */ private Date updatedTime; -} \ No newline at end of file +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerHomeTemplateDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerHomeTemplateDTO.java index e0e3ec6091..866adac425 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerHomeTemplateDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerHomeTemplateDTO.java @@ -23,7 +23,7 @@ import lombok.Data; /** - * 客户首页模板表 + * 客户首页模板表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-10 @@ -49,9 +49,9 @@ public class CustomerHomeTemplateDTO implements Serializable { private Integer clientType; /** - * 所属区域:0.标题区、1.置顶区、2.功能区、3.悬浮区 + * 所属区域:titleList.标题区、topList.置顶区、functionList.功能区、floatingList.悬浮区 */ - private Integer region; + private String region; /** * 高级配置 JSON串 @@ -93,4 +93,4 @@ public class CustomerHomeTemplateDTO implements Serializable { */ private Date updatedTime; -} \ No newline at end of file +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/HomeComponentDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/HomeComponentDTO.java index 13ecb98094..1d1e437f1f 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/HomeComponentDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/HomeComponentDTO.java @@ -23,7 +23,7 @@ import lombok.Data; /** - * 首页组件表 + * 首页组件表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-10 @@ -64,9 +64,9 @@ public class HomeComponentDTO implements Serializable { private Integer conponentType; /** - * 所属区域:0.标题区、1.置顶区、2.功能区、3.悬浮区 + * 所属区域:titleList.标题区、topList.置顶区、functionList.功能区、floatingList.悬浮区 */ - private Integer region; + private String region; /** * 高级配置 @@ -113,4 +113,4 @@ public class HomeComponentDTO implements Serializable { */ private Date updatedTime; -} \ No newline at end of file +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/constant/OperCustomizeConstant.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/constant/OperCustomizeConstant.java new file mode 100644 index 0000000000..dfddc87a50 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/constant/OperCustomizeConstant.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.epmet.dto.constant; + +/** + * 常量 + * @author sun + * @since 1.0.0 + */ +public interface OperCustomizeConstant { + /** + * 数据状态-已发布 + */ + String STATUS = "0"; + /** + * 数据状态-草稿 + */ + String STATUS_ONE = "1"; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerHomeFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerHomeFormDTO.java new file mode 100644 index 0000000000..1cba7b47ab --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerHomeFormDTO.java @@ -0,0 +1,34 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 陌生人导览-点击网格链接获取客户首页配置入参DTO + * @Author sun + * @Date 2020/3/16 11:27 + */ +@Data +public class CustomerHomeFormDTO implements Serializable { + private static final long serialVersionUID = 5272251336837515372L; + /** + * 客户ID + */ + @NotBlank(message = "客户ID不能为空") + private String customerId; + + /** + * 所属端类型0.居民端,1.政府端 + */ + @NotBlank(message = "所属端类型不能为空(0居民端1政府端)") + private String clientType; + + /** + * 状态:0.已发布 1.草稿 + */ + @NotBlank(message = "状态(0已发布1草稿)") + private String status; + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeComponentFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeComponentFormDTO.java new file mode 100644 index 0000000000..e9d71ef719 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeComponentFormDTO.java @@ -0,0 +1,42 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 运营端-客户定制化服务-首页设计稿组件上传数据-入参 + * @author zhaoqifeng + * @date 2020/3/16 11:27 + */ +@Data +public class HomeComponentFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 组件id + */ + private String componentId; + + /** + * 所属区域:titleList.标题区、topList.置顶区、functionList.功能区、floatingList.悬浮区 + */ + private String region; + + /** + * 高级配置项 + */ + private String configuration; + + /** + * 默认数据 + */ + private String demoData; + + /** + * 显示顺序 + */ + private Integer displayOrder; + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeDesignByCustomerFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeDesignByCustomerFormDTO.java new file mode 100644 index 0000000000..fddbedad98 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeDesignByCustomerFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 运营端-客户定制化服务-获取客户首页配置的设计稿-入参 + * @Author yangshaoping + * @Date 2020/3/16 11:27 + */ +@Data +public class HomeDesignByCustomerFormDTO implements Serializable { + private static final long serialVersionUID = 5272251336837515372L; + /** + * 客户ID + */ + @NotBlank(message = "客户ID不能为空") + private String customerId; + + /** + * 所属端类型0.居民端,1.政府端 + */ + @NotBlank(message = "所属端类型不能为空(0居民端1政府端)") + private String clientType; + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeDesignFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeDesignFormDTO.java new file mode 100644 index 0000000000..c51b897775 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/HomeDesignFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.form; +/** + * 运营端-客户定制化服务-首页设计稿组件上传数据-入参 + * @author zhaoqifeng + * @date 2020/3/16 11:27 + */ + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class HomeDesignFormDTO implements Serializable { + + + private static final long serialVersionUID = -246434129998560246L; + + /** + * 客户id + */ + private String customerId; + + /** + * 所属端类型 0:居民端 1:政府端 + */ + private String clientType; + + /** + * 组件集合 + */ + private List componentList; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CommonComponentDesignResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CommonComponentDesignResultDTO.java new file mode 100644 index 0000000000..bd65f9fe44 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CommonComponentDesignResultDTO.java @@ -0,0 +1,50 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 运营端-客户定制化服务-获取客户可用组件列表-返参[commonList(通用组件列表)属性对应DTO] + * @Author yang + * @Date 2020/3/16 12:59 + */ +@Data +public class CommonComponentDesignResultDTO implements Serializable { + private static final long serialVersionUID = 2971689193155710437L; + + /** + * 组件id + */ + private String componentId; + + /** + * 组件名称 + */ + private String componentName; + /** + * 所属区域 + */ + private String region; + + /** + * 组件前端标识 + */ + private String componentFrontId; + + /** + * 高级设置 + */ + private String configuration; + + /** + * 默认数据 + */ + private String demoData; + + /** + * 显示顺序 + */ + private int displayOrder; + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CommonComponentResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CommonComponentResultDTO.java index 8e57e9fd5c..7e2dc3c4f3 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CommonComponentResultDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CommonComponentResultDTO.java @@ -42,4 +42,9 @@ public class CommonComponentResultDTO implements Serializable { * 配置项说明 */ private String configurationDescription; + + /** + * 所属区域:0.标题区、1.置顶区、2.功能区、3.悬浮区 + */ + private String region; } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/HomeDesignByCustomerResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/HomeDesignByCustomerResultDTO.java new file mode 100644 index 0000000000..64dbfdaa26 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/HomeDesignByCustomerResultDTO.java @@ -0,0 +1,37 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.Set; + +/** + * @Description 运营端-客户定制化服务-获取客户首页配置的设计稿返参 + * @Author yang + * @Date 2020/3/16 12:57 + */ +@Data +public class HomeDesignByCustomerResultDTO implements Serializable { + private static final long serialVersionUID = 1496786567582303921L; + /** + * 标题区 + */ + private List titleList; + /** + * 置顶区 + */ + private List topList; + /** + * 功能区 + */ + private List functionList; + /** + * 悬浮区 + */ + private List floatingList; + /** + *用于标识已使用的功能组件id列表(不含通用组件) + */ + private List usedComponentIdList; +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/constant/ReginConstant.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/constant/ReginConstant.java new file mode 100644 index 0000000000..1a1b1fec32 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/constant/ReginConstant.java @@ -0,0 +1,19 @@ +package com.epmet.constant; + +/** + * @Classname ReginEnum + * @Description 所属区域:0.标题区、1.置顶区、2.功能区、3.悬浮区 + * @Date 2020/3/17 15:22 + * @Created by yangs + */ +public interface ReginConstant { + //所属区域:0.标题区、1.置顶区、2.功能区、3.悬浮区 + //0.标题区 + String titleList="titleList"; + //1.置顶区 + String topList="topList"; + //2.功能区 + String functionList="functionList"; + //3.悬浮区 + String floatingList="floatingList"; +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/HomeController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/HomeController.java index e8000ab20d..e528ed9b83 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/HomeController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/HomeController.java @@ -2,12 +2,19 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.constant.OperCustomizeConstant; import com.epmet.dto.form.ComponentListByCustomerFormDTO; +import com.epmet.dto.form.CustomerHomeFormDTO; +import com.epmet.dto.form.HomeDesignByCustomerFormDTO; +import com.epmet.dto.form.HomeDesignFormDTO; import com.epmet.dto.result.ComponentListByCustomerResultDTO; +import com.epmet.dto.result.HomeDesignByCustomerResultDTO; import com.epmet.service.HomeService; -import net.bytebuddy.asm.Advice; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; /** * @Description 客户定制化服务-首页相关接口 @@ -33,4 +40,59 @@ public class HomeController { ValidatorUtils.validateEntity(formDTO); return homeService.getComponentListByCustomer(formDTO); } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yang + * @Description 获取客户首页配置的设计稿 + * @Date 2020/3/16 13:21 + **/ + @PostMapping("gethomedesignbycustomer") + public Result getHomeDesignByCustomer(@RequestBody HomeDesignByCustomerFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return homeService.getHomeDesignByCustomer(formDTO); + } + + /** + * 首页设计稿组件上传数据 + * @param formDTO 参数 + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * Date 2020/3/16 13:21 + **/ + @PostMapping("savehomedesign") + public Result saveHomeDesign(@RequestBody HomeDesignFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + homeService.saveHomeDesign(formDTO); + return new Result(); + } + + /** + * 首页设计稿发版 + * @param formDTO 参数 + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * Date 2020/3/16 13:21 + **/ + @PostMapping("distributehomedesign") + public Result distributeHomeDesign(@RequestBody HomeDesignFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + homeService.distributeHomeDesign(formDTO); + return new Result(); + } + + /** + * 供resi-guide服务调用 获取客户首页配置 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author sun + * @Description 获取客户首页发布数据 + **/ + @PostMapping("gethomereleasebycustomer") + public Result getHomeReleaseByCustomer(@RequestBody CustomerHomeFormDTO formDTO) { + formDTO.setStatus(OperCustomizeConstant.STATUS);//已发布数据 + ValidatorUtils.validateEntity(formDTO); + return homeService.getHomeReleaseByCustomer(formDTO); + } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java index 6bffb6e6a6..42bc2824b4 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java @@ -18,9 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.HomeDesignFormDTO; import com.epmet.entity.CustomerHomeEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 客户首页表 * @@ -29,5 +32,15 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CustomerHomeDao extends BaseDao { - + + /** + * + * 客户首页列表查询 + * + * @param formDTO + * @return java.util.List + * @author zhaoqifeng + * @date 2020/3/16 14:02 + **/ + List selectCustomerHomeList(HomeDesignFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDetailDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDetailDao.java index 5c792c3394..2ad445ea6f 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDetailDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDetailDao.java @@ -18,9 +18,14 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.CustomerHomeFormDTO; +import com.epmet.dto.form.HomeDesignByCustomerFormDTO; +import com.epmet.dto.result.CommonComponentDesignResultDTO; import com.epmet.entity.CustomerHomeDetailEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 客户首页详情表 * @@ -29,5 +34,22 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CustomerHomeDetailDao extends BaseDao { - + /** + * + * 根据界面id清除数据 + * + * @param homeId 界面ID + * @author zhaoqifeng + * @date 2020/3/16 14:02 + */ + void updateCustomerHomeDetailByHomeId(String homeId); + /** + * + * 根据客户id,所属端获取客户首页配置的设计稿 + * @author yangshaoping + * @date 2020/3/1714:02 + */ + List getCustomerHomeDetailComponent(HomeDesignByCustomerFormDTO form); + + List getHomeReleaseByCustomer(CustomerHomeFormDTO form); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeTemplateDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeTemplateDao.java index 21bf5f55ae..5e60376eb5 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeTemplateDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeTemplateDao.java @@ -29,5 +29,5 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CustomerHomeTemplateDao extends BaseDao { - + } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerHomeDetailEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerHomeDetailEntity.java index bcc2eedb3a..e6a753278b 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerHomeDetailEntity.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerHomeDetailEntity.java @@ -26,7 +26,7 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 客户首页详情表 + * 客户首页详情表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-10 @@ -49,9 +49,9 @@ public class CustomerHomeDetailEntity extends BaseEpmetEntity { private String componentId; /** - * 所属区域:0.标题区、1.置顶区、2.功能区、3.悬浮区 + * 所属区域:titleList.标题区、topList.置顶区、functionList.功能区、floatingList.悬浮区 */ - private Integer region; + private String region; /** * 高级配置 diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerHomeTemplateEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerHomeTemplateEntity.java index 189a14d56d..36c677ef90 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerHomeTemplateEntity.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerHomeTemplateEntity.java @@ -26,7 +26,7 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 客户首页模板表 + * 客户首页模板表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-10 @@ -49,9 +49,9 @@ public class CustomerHomeTemplateEntity extends BaseEpmetEntity { private Integer clientType; /** - * 所属区域:0.标题区、1.置顶区、2.功能区、3.悬浮区 + * 所属区域:titleList.标题区、topList.置顶区、functionList.功能区、floatingList.悬浮区 */ - private Integer region; + private String region; /** * 高级配置 JSON串 diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/HomeComponentEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/HomeComponentEntity.java index 6705b6e9e9..5cbb92b0c6 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/HomeComponentEntity.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/HomeComponentEntity.java @@ -26,7 +26,7 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 首页组件表 + * 首页组件表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-10 @@ -64,9 +64,9 @@ public class HomeComponentEntity extends BaseEpmetEntity { private Integer conponentType; /** - * 所属区域:0.标题区、1.置顶区、2.功能区、3.悬浮区 + * 所属区域:titleList.标题区、topList.置顶区、functionList.功能区、floatingList.悬浮区 */ - private Integer region; + private String region; /** * 高级配置 diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/HomeService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/HomeService.java index 50156cef76..375d092f81 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/HomeService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/HomeService.java @@ -2,7 +2,11 @@ package com.epmet.service; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.ComponentListByCustomerFormDTO; +import com.epmet.dto.form.CustomerHomeFormDTO; +import com.epmet.dto.form.HomeDesignByCustomerFormDTO; +import com.epmet.dto.form.HomeDesignFormDTO; import com.epmet.dto.result.ComponentListByCustomerResultDTO; +import com.epmet.dto.result.HomeDesignByCustomerResultDTO; /** * @Description 客户定制化服务-首页 @@ -18,4 +22,39 @@ public interface HomeService { * @Date 2020/3/11 13:22 **/ Result getComponentListByCustomer(ComponentListByCustomerFormDTO formDTO); + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yang + * @Description 获取客户首页配置的设计稿 + * @Date 2020/3/16 13:21 + **/ + Result getHomeDesignByCustomer(HomeDesignByCustomerFormDTO formDTO); + + /** + * + * 首页设计稿组件上传数据 + * @param: formDTO + * @author: zhaoqifeng + * @date: 2020/03/16 13:49:41 + */ + void saveHomeDesign(HomeDesignFormDTO formDTO); + + /** + * + * 首页设计稿发版 + * @param: formDTO + * @author: zhaoqifeng + * @date: 2020/03/16 13:49:41 + */ + void distributeHomeDesign(HomeDesignFormDTO formDTO); + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author sun + * @Description 获取客户首页发布数据 + **/ + Result getHomeReleaseByCustomer(CustomerHomeFormDTO formDTO); } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/HomeServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/HomeServiceImpl.java index 18671698af..68d3faff90 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/HomeServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/HomeServiceImpl.java @@ -1,13 +1,23 @@ package com.epmet.service.impl; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.ReginConstant; +import com.epmet.dao.CustomerHomeDao; +import com.epmet.dao.CustomerHomeDetailDao; import com.epmet.dao.HomeComponentDao; -import com.epmet.dto.form.ComponentListByCustomerFormDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.CommonComponentDesignResultDTO; import com.epmet.dto.result.ComponentListByCustomerResultDTO; +import com.epmet.dto.result.HomeDesignByCustomerResultDTO; +import com.epmet.entity.CustomerHomeDetailEntity; +import com.epmet.entity.CustomerHomeEntity; import com.epmet.service.HomeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.List; + /** * @Description 客户定制化服务-首页 * @Author yinzuomei @@ -15,14 +25,122 @@ import org.springframework.stereotype.Service; */ @Service public class HomeServiceImpl implements HomeService { + @Autowired + private HomeComponentDao homeComponentDao; + @Autowired + private CustomerHomeDetailDao customerHomeDetailDao; @Autowired - private HomeComponentDao homeComponentDao; + private CustomerHomeDao customerHomeDao; + + @Override + public Result getComponentListByCustomer(ComponentListByCustomerFormDTO formDTO) { + ComponentListByCustomerResultDTO resultDTO = new ComponentListByCustomerResultDTO(); + resultDTO.setCommonList(homeComponentDao.selectListCommonComponentResultDTO(formDTO)); + resultDTO.setFunctionList(homeComponentDao.selectListFunctionComponentResultDTO(formDTO)); + return new Result().ok(resultDTO); + } + + @Override + public Result getHomeDesignByCustomer(HomeDesignByCustomerFormDTO formDTO) { + HomeDesignByCustomerResultDTO resultDTO = new HomeDesignByCustomerResultDTO(); + //根据客户id,所属端获取客户首页配置的设计稿 + List list = customerHomeDetailDao.getCustomerHomeDetailComponent(formDTO); + List titlelist=new ArrayList(); + List toplist=new ArrayList(); + List functionlist=new ArrayList(); + List floatlist=new ArrayList(); + List usedComponent=new ArrayList<>();//使用过的组件集合 + for(CommonComponentDesignResultDTO c:list){ + usedComponent.add(c.getComponentId()); + //所属区域:0.标题区、1.置顶区、2.功能区、3.悬浮区 + if(ReginConstant.titleList.equals(c.getRegion())){ + titlelist.add(c); + }else if(ReginConstant.topList.equals(c.getRegion())){ + toplist.add(c); + }else if(ReginConstant.functionList.equals(c.getRegion())){ + functionlist.add(c); + }else if(ReginConstant.floatingList.equals(c.getRegion())){ + floatlist.add(c); + } + } + resultDTO.setTitleList(titlelist); + resultDTO.setTopList(toplist); + resultDTO.setFloatingList(floatlist); + resultDTO.setFunctionList(functionlist); + resultDTO.setUsedComponentIdList(usedComponent); + return new Result().ok(resultDTO); + } @Override - public Result getComponentListByCustomer(ComponentListByCustomerFormDTO formDTO) { - ComponentListByCustomerResultDTO resultDTO = new ComponentListByCustomerResultDTO(); - resultDTO.setCommonList(homeComponentDao.selectListCommonComponentResultDTO(formDTO)); - resultDTO.setFunctionList(homeComponentDao.selectListFunctionComponentResultDTO(formDTO)); - return new Result().ok(resultDTO); + public void saveHomeDesign(HomeDesignFormDTO formDTO) { + //根据客户ID和所属端类型从客户首页表找到对应的已发布和草稿 + List customerHomeList = customerHomeDao.selectCustomerHomeList(formDTO); + + //只处理草稿的数据 + for(CustomerHomeEntity entity : customerHomeList) { + if (entity.getStatus() == 1) { + saveCustomerHomeDetail(formDTO, entity); + } + } } + + @Override + public void distributeHomeDesign(HomeDesignFormDTO formDTO) { + //根据客户ID和所属端类型从客户首页表找到对应的已发布和草稿 + List customerHomeList = customerHomeDao.selectCustomerHomeList(formDTO); + + //草稿和模板数据都要处理 + for(CustomerHomeEntity entity : customerHomeList) { + saveCustomerHomeDetail(formDTO, entity); + } + } + + private void saveCustomerHomeDetail(HomeDesignFormDTO formDTO, CustomerHomeEntity entity) { + //根据homeID清空客户首页详情表中的数据 + customerHomeDetailDao.updateCustomerHomeDetailByHomeId(entity.getId()); + + //将数据存入客户首页详情表 + for (HomeComponentFormDTO homeComponentForm : formDTO.getComponentList()) { + CustomerHomeDetailEntity customerHomeDetailEntity = new CustomerHomeDetailEntity(); + customerHomeDetailEntity.setHomeId(entity.getId()); + customerHomeDetailEntity.setComponentId(homeComponentForm.getComponentId()); + customerHomeDetailEntity.setRegion(homeComponentForm.getRegion()); + customerHomeDetailEntity.setConfiguration(homeComponentForm.getConfiguration()); + customerHomeDetailEntity.setDemoData(homeComponentForm.getDemoData()); + customerHomeDetailEntity.setDisplayOrder(homeComponentForm.getDisplayOrder()); + customerHomeDetailDao.insert(customerHomeDetailEntity); + + } + } + + @Override + public Result getHomeReleaseByCustomer(CustomerHomeFormDTO formDTO) { + HomeDesignByCustomerResultDTO resultDTO = new HomeDesignByCustomerResultDTO(); + //根据客户id,所属端获取客户首页配置的设计稿 + List list = customerHomeDetailDao.getHomeReleaseByCustomer(formDTO); + List titlelist=new ArrayList(); + List toplist=new ArrayList(); + List functionlist=new ArrayList(); + List floatlist=new ArrayList(); + //List usedComponent=new ArrayList<>();//使用过的组件集合 + for(CommonComponentDesignResultDTO c:list){ + //usedComponent.add(c.getComponentId()); + //所属区域:0.标题区、1.置顶区、2.功能区、3.悬浮区 + if(ReginConstant.titleList.equals(c.getRegion())){ + titlelist.add(c); + }else if(ReginConstant.topList.equals(c.getRegion())){ + toplist.add(c); + }else if(ReginConstant.functionList.equals(c.getRegion())){ + functionlist.add(c); + }else if(ReginConstant.floatingList.equals(c.getRegion())){ + floatlist.add(c); + } + } + resultDTO.setTitleList(titlelist); + resultDTO.setTopList(toplist); + resultDTO.setFloatingList(floatlist); + resultDTO.setFunctionList(functionlist); + //resultDTO.setUsedComponentIdList(usedComponent); + return new Result().ok(resultDTO); + } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDao.xml index 1ae417cdc0..3bc7dfdb23 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDao.xml @@ -16,5 +16,18 @@ + + + \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml index b3c5917560..b5aac36854 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml @@ -18,5 +18,68 @@ + + UPDATE + CUSTOMER_HOME_DETAIL + set + DEL_FLAG = 1 + WHERE + HOME_ID = #{homeId} + AND DEL_FLAG = 0 + + + + + + \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/HomeComponentDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/HomeComponentDao.xml index ff4d87350e..10bfc66952 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/HomeComponentDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/HomeComponentDao.xml @@ -32,7 +32,8 @@ hc.COMPONENT_FRONT_ID, hc.CONFIGURATION, hc.DEMO_DATA, - hc.CONFIGURATION_DESCRIPTION + hc.CONFIGURATION_DESCRIPTION, + hc.REGION FROM home_component hc WHERE @@ -85,7 +86,8 @@ hc.COMPONENT_FRONT_ID, hc.CONFIGURATION, hc.DEMO_DATA, - hc.CONFIGURATION_DESCRIPTION + hc.CONFIGURATION_DESCRIPTION, + hc.REGION FROM home_component hc WHERE diff --git a/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/CustomerGridListQueryDTO.java b/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/CustomerGridListQueryDTO.java new file mode 100644 index 0000000000..b51dd9e7bc --- /dev/null +++ b/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/CustomerGridListQueryDTO.java @@ -0,0 +1,64 @@ +package com.epmet.dto;/** + * Created by 11 on 2020/3/17. + */ + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description + * @ClassName CustomerGridListQueryDTO + * @Author wangc + * @date 2020.03.17 13:45 + */ +@Data +public class CustomerGridListQueryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 当前页 + * */ + @Min(value = 1) + private Integer pageNo; + + /** + * 每页数量 + * */ + private Integer pageSize = 20; + + /** + * 地区码 + * */ + private String areaCode; + + /** + * 选定地区编码 + * */ + private String selectedAreaCode; + + /** + * 是否首次位置授权(0:是 1:否) + */ + private Integer isAuthorized; + + /** + * 前端传递的省份 + * */ + @NotBlank(message = "省份信息不能为空") + private String province; + + /** + * 前端传递的城市 + * */ + @NotBlank(message = "城市信息不能为空") + private String city; + + /** + * 前端传递的地区 + * */ + private String area; +} diff --git a/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/StrangerAccessRecordDTO.java b/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/StrangerAccessRecordDTO.java new file mode 100644 index 0000000000..183bc5fb2f --- /dev/null +++ b/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/StrangerAccessRecordDTO.java @@ -0,0 +1,111 @@ +/** + * 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.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 陌生人访问记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-19 + */ +@Data +public class StrangerAccessRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 定位地区编码 (用户允许获取位置) + */ + private String locationAreaCode; + + /** + * 选择地区编码 (用户选择地区位置 + */ + private String lelectedAreaCode; + + /** + * 省份 + */ + private String province; + + /** + * 城市 + */ + private String city; + + /** + * 城市 + */ + private String area; + + /** + * 是否首次位置授权(0:是 1:否) + */ + private Integer isAuthorized; + + /** + * 网格数 根据位置查询到的附近网格数 + */ + private Integer gridNumber; + + /** + * 访问时间 访问的当前时间 + */ + private Date visitTime; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/form/CustomerGridListFormDTO.java b/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/form/CustomerGridListFormDTO.java new file mode 100644 index 0000000000..93776cfa94 --- /dev/null +++ b/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/form/CustomerGridListFormDTO.java @@ -0,0 +1,61 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description + * @ClassName CustomerGridListFormDTO + * @Author wangc + * @date 2020.03.19 14:19 + */ +@Data +public class CustomerGridListFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 当前页 + * */ + @Min(value = 1) + private Integer pageNo; + + /** + * 每页数量 + * */ + private Integer pageSize = 20; + + /** + * 地区码 + * */ + private String areaCode; + + /** + * 选定地区编码 + * */ + private String selectedAreaCode; + + /** + * 是否首次位置授权(0:是 1:否) + */ + private Integer isAuthorized; + + /** + * 前端传递的省份 + * */ + @NotBlank(message = "省份信息不能为空") + private String province; + + /** + * 前端传递的城市 + * */ + @NotBlank(message = "城市信息不能为空") + private String city; + + /** + * 前端传递的地区 + * */ + private String area; +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/PdmanDbVersionExcel.java b/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/form/StrangerFormDTO.java similarity index 60% rename from epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/PdmanDbVersionExcel.java rename to epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/form/StrangerFormDTO.java index 1bb5b05b13..ce7197da17 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/PdmanDbVersionExcel.java +++ b/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/form/StrangerFormDTO.java @@ -15,30 +15,33 @@ * along with this program. If not, see . */ -package com.epmet.excel; +package com.epmet.dto.form; -import cn.afterturn.easypoi.excel.annotation.Excel; import lombok.Data; -import java.util.Date; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + /** - * - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-03-16 + * 居民端-网格链接获取客户首页配置入参 + * @author sun */ @Data -public class PdmanDbVersionExcel { - - @Excel(name = "") - private String dbVersion; +public class StrangerFormDTO implements Serializable { - @Excel(name = "") - private String versionDesc; + private static final long serialVersionUID = 1L; - @Excel(name = "") - private String createdTime; + /** + * 网格Id + */ + @NotBlank(message = "网格ID不能为空") + private String gridId; + /** + * 客户Id CUSTOMER.id + */ + @NotBlank(message = "客户ID不能为空") + private String customerId; } \ No newline at end of file diff --git a/epmet-module/resi-guide/resi-guide-server/pom.xml b/epmet-module/resi-guide/resi-guide-server/pom.xml index d51420a810..f5959bc1c1 100644 --- a/epmet-module/resi-guide/resi-guide-server/pom.xml +++ b/epmet-module/resi-guide/resi-guide-server/pom.xml @@ -58,6 +58,24 @@ feign-httpclient 10.3.0 + + com.epmet + epmet-user-client + 2.0.0 + compile + + + com.epmet + gov-org-client + 2.0.0 + compile + + + com.epmet + oper-customize-client + 2.0.0 + compile + diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerAccessRecordController.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerAccessRecordController.java new file mode 100644 index 0000000000..e2a164c48f --- /dev/null +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerAccessRecordController.java @@ -0,0 +1,89 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.StrangerAccessRecordDTO; +import com.epmet.dto.form.CustomerGridListFormDTO; +import com.epmet.dto.result.CustomerGridForStrangerResultDTO; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.excel.StrangerAccessRecordExcel; +import com.epmet.service.StrangerAccessRecordService; +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; + +/** + * @Description 陌生人导览模块 + * @ClassName StrangerAccessRecordController + * @Author wangc + * @date 2020.03.17 11:33 + */ +@RestController +@RequestMapping("strangerAccessRecord") +public class StrangerAccessRecordController { + + @Autowired + private StrangerAccessRecordService strangerAccessRecordService; + + + + /** + * 查询陌生人访问记录 + * @Author yangshaoping + * @date 2020.03.1811:33 + * */ + @GetMapping("getStrangerAccessRecordPage") + public Result> getStrangerAccessRecordPage(@RequestParam Map params){ + PageData page = strangerAccessRecordService.getStrangerAccessRecordPage(params); + return new Result>().ok(page); + } + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = strangerAccessRecordService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + StrangerAccessRecordDTO data = strangerAccessRecordService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody StrangerAccessRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + strangerAccessRecordService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody StrangerAccessRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + strangerAccessRecordService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + strangerAccessRecordService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = strangerAccessRecordService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, StrangerAccessRecordExcel.class); + } +} diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java new file mode 100644 index 0000000000..5f97343835 --- /dev/null +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java @@ -0,0 +1,94 @@ +/** + * 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.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.CustomerGridListFormDTO; +import com.epmet.dto.form.StrangerFormDTO; +import com.epmet.dto.result.CustomerGridForStrangerResultDTO; +import com.epmet.dto.result.HomeDesignByCustomerResultDTO; +import com.epmet.service.StrangerAccessRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + + +/** + * 居民端-陌生人导览 + * @author sun + * @since v1.0.0 2020-03-16 + */ +@RestController +@RequestMapping("stranger") +public class StrangerResiGuideController { + + @Autowired + private StrangerAccessRecordService strangerAccessRecordService; + + /** + * @param + * @Author sun + * @Description 居民端-陌生人导览-网格链接获取客户首页配置 + * @Date 2020/3/16 + **/ + @PostMapping("getgridhome") + public Result getValidCustomerList( @LoginUser TokenDto tokenDTO, @RequestBody StrangerFormDTO formDTO) throws Exception { + return strangerAccessRecordService.getgridhome(tokenDTO, formDTO); + } + + + + /** + * @Description 陌生访客根据自动定位获取附近网格数据 + * @Param CustomerGridListFormDTO + * @return Result> + * @Author wangc + * @Date 2020.03.19 14:13 + **/ + @PostMapping("getlocationcustomergridlist") + Result> getLocationCustomerGridList(@RequestBody CustomerGridListFormDTO customerGridListFormDTO){ + + ValidatorUtils.validateEntity(customerGridListFormDTO); + + return strangerAccessRecordService.listCustomerGrid(customerGridListFormDTO); + + } + + /** + * @Description 陌生访客手动选定位置获取附近网格数据 + * @Param CustomerGridListFormDTO + * @return Result> + * @Author wangc + * @Date 2020.03.19 14:13 + **/ + @PostMapping("getselectcdcustomergridlist") + Result> getSelectcdCustomerGridList(@RequestBody CustomerGridListFormDTO customerGridListFormDTO){ + + ValidatorUtils.validateEntity(customerGridListFormDTO); + + return strangerAccessRecordService.listCustomerGrid(customerGridListFormDTO); + } + +} diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/dao/StrangerAccessRecordDao.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/dao/StrangerAccessRecordDao.java new file mode 100644 index 0000000000..625e30b399 --- /dev/null +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/dao/StrangerAccessRecordDao.java @@ -0,0 +1,43 @@ +/** + * 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.epmet.dao; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.StrangerAccessRecordEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +/** + * 陌生人访问记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Mapper +public interface StrangerAccessRecordDao extends BaseDao { + /** + * 查询陌生人访问记录 + * @param params + * @author yangshaoping + * @date 2020-03-19 + */ + List getStrangerAccessRecordPage(Map params); +} \ No newline at end of file diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/entity/StrangerAccessRecordEntity.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/entity/StrangerAccessRecordEntity.java new file mode 100644 index 0000000000..f9788d9b36 --- /dev/null +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/entity/StrangerAccessRecordEntity.java @@ -0,0 +1,81 @@ +/** + * 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.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 陌生人访问记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("stranger_access_record") +public class StrangerAccessRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 定位地区编码 (用户允许获取位置) + */ + private String locationAreaCode; + + /** + * 选择地区编码 (用户选择地区位置 + */ + private String selectedAreaCode; + + /** + * 是否首次位置授权(0:是 1:否) + */ + private Integer isAuthorized; + + /** + * 网格数 根据位置查询到的附近网格数 + */ + private Integer gridNumber; + + /** + * 访问时间 访问的当前时间 + */ + private Date visitTime; + + /** + * 省份 + * */ + private String province; + + /** + * 城市 + * */ + private String city; + + /** + * 地区 + * */ + private String area; + +} diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/excel/StrangerAccessRecordExcel.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/excel/StrangerAccessRecordExcel.java new file mode 100644 index 0000000000..977f253ef3 --- /dev/null +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/excel/StrangerAccessRecordExcel.java @@ -0,0 +1,71 @@ +/** + * 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.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 陌生人访问记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Data +public class StrangerAccessRecordExcel { + + @Excel(name = "唯一标识") + private String id; + + @Excel(name = "定位地区编码 (用户允许获取位置)") + private String locationAreaCode; + + @Excel(name = "选择地区编码 (用户选择地区位置") + private String lelectedAreaCode; + + @Excel(name = "是否首次位置授权(0:是 1:否)") + private Integer isAuthorized; + + @Excel(name = "网格数 根据位置查询到的附近网格数") + private Integer gridNumber; + + @Excel(name = "访问时间 访问的当前时间") + private Date visitTime; + + @Excel(name = "删除标识:0.未删除 1.已删除") + private Integer 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; + + +} \ No newline at end of file diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java new file mode 100644 index 0000000000..0268ea99ec --- /dev/null +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -0,0 +1,28 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.VisitedFormDTO; +import com.epmet.feign.fallback.EpmetUserFeignClientFallBack; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; + +/** + * @Description 居民端陌生人导览 调用epmet-user服务 + * @Author sun + */ +@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class) +public interface EpmetUserFeignClient { + + /** + * 保存或更新网格访问记录表和最近访问网格表数据 + * @param + * @Description + **/ + @PostMapping("/epmetuser/gridvisited/savelatestandvisited") + Result saveLatestAndVisited(VisitedFormDTO formDTO); + + + + +} diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java new file mode 100644 index 0000000000..c6721d4c14 --- /dev/null +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -0,0 +1,39 @@ +package com.epmet.feign; + + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.dto.result.CustomerGridForStrangerResultDTO; +import com.epmet.feign.fallback.GovOrgFeignFallBack; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + + +import java.util.List; + + +/** + * @Description Feign调用gov-org-server模块下的CustomerGirdController + * @ClassName GovOrgFeginFallBack + * @Author wangc + * @date 2020.03.17 14:29 + */ +@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignFallBack.class) +public interface GovOrgFeignClient { + + /** + * 根据地区编码获取附近网格数据 + * @Param areaCode 地区编码 + * @Param pageNo 当前页 + * @Param pageSize 每页数据量 + * */ + @PostMapping("/gov/org/customergrid/queryListForStrangerByOrder") + Result> getPageForStrangerGuideInterface(@RequestBody ListCustomerGridFormDTO listCustomerGridFormDTO); + + + + + +} diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/OperCustomizeFeignClient.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/OperCustomizeFeignClient.java new file mode 100644 index 0000000000..0a3eb35a01 --- /dev/null +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/OperCustomizeFeignClient.java @@ -0,0 +1,27 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.CustomerHomeFormDTO; +import com.epmet.dto.result.HomeDesignByCustomerResultDTO; +import com.epmet.feign.fallback.OperCustomizeFeignClientFallBack; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; + +/** + * @Description 居民端陌生人导览 调用oper_customize服务 + * @Author sun + * @Date 2020/3/16 + */ +@FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallback = OperCustomizeFeignClientFallBack.class) +public interface OperCustomizeFeignClient { + + /** + * @param + * @Description 根据客户Id查询客户用户表数据 + * @Date 2020/3/17 + **/ + @PostMapping("/oper/customize/home/gethomereleasebycustomer") + Result getHomeReleaseByCustomer(CustomerHomeFormDTO formDTO); + +} diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java new file mode 100644 index 0000000000..60688ad717 --- /dev/null +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java @@ -0,0 +1,24 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.VisitedFormDTO; +import com.epmet.feign.EpmetUserFeignClient; +import org.springframework.stereotype.Component; + +/** + * @Description 居民端-陌生人导览 调用epmet-user服务 + * @Author sun + * @Date 2020/3/16 + */ +@Component +public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { + + @Override + public Result saveLatestAndVisited(VisitedFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveLatestAndVisited",formDTO); + } + + +} diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignFallBack.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignFallBack.java new file mode 100644 index 0000000000..0554f8be50 --- /dev/null +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignFallBack.java @@ -0,0 +1,32 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.dto.result.CustomerGridForStrangerResultDTO; +import com.epmet.feign.GovOrgFeignClient; +import org.springframework.stereotype.Component; + + +import java.util.List; + +/** + * @Description Feign + * @ClassName GovOrgFeginFallBack + * @Author wangc + * @date 2020.03.17 14:29 + */ +@Component +public class GovOrgFeignFallBack implements GovOrgFeignClient { + + /** + * 根据地区编码获取附近网格数据 + * @Param ListCustomerGridFormDTO 包含:地区编码、页码、每页数据量 + * @return Result> + * */ + @Override + public Result> getPageForStrangerGuideInterface(ListCustomerGridFormDTO listCustomerGridFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "queryListForStrangerByOrder",listCustomerGridFormDTO); + } +} diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/fallback/OperCustomizeFeignClientFallBack.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/fallback/OperCustomizeFeignClientFallBack.java new file mode 100644 index 0000000000..95853e7da3 --- /dev/null +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/fallback/OperCustomizeFeignClientFallBack.java @@ -0,0 +1,23 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.CustomerHomeFormDTO; +import com.epmet.dto.result.HomeDesignByCustomerResultDTO; +import com.epmet.feign.OperCustomizeFeignClient; +import org.springframework.stereotype.Component; + +/** + * @Description 居民端-陌生人导览 调用oper-customize服务 + * @Author sun + * @Date 2020/3/16 + */ +@Component +public class OperCustomizeFeignClientFallBack implements OperCustomizeFeignClient { + + @Override + public Result getHomeReleaseByCustomer(CustomerHomeFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getHomeReleaseByCustomer",formDTO); + } +} diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/StrangerAccessRecordService.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/StrangerAccessRecordService.java new file mode 100644 index 0000000000..c0c0824075 --- /dev/null +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/StrangerAccessRecordService.java @@ -0,0 +1,110 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.StrangerAccessRecordDTO; +import com.epmet.dto.form.CustomerGridListFormDTO; +import com.epmet.dto.form.StrangerFormDTO; +import com.epmet.dto.result.CustomerGridForStrangerResultDTO; +import com.epmet.dto.result.HomeDesignByCustomerResultDTO; +import com.epmet.entity.StrangerAccessRecordEntity; + +import java.util.List; +import java.util.Map; + +/** + * @Description 陌生人记录访问表 + * @InterfaceName ResiGuideServiceImpl + * @Author wangc + * @date 2020.03.17 13:01 + */ + +public interface StrangerAccessRecordService extends BaseService { + + /** + * 查询陌生人访问记录 + * @param params + * @return PageData + * @author yangshaoping + * @date 2020-03-19 + */ + PageData getStrangerAccessRecordPage(Map params); + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-03-19 + */ + PageData page(Map params); + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-03-19 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return StrangerAccessRecordDTO + * @author generator + * @date 2020-03-19 + */ + StrangerAccessRecordDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-19 + */ + void save(StrangerAccessRecordDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-19 + */ + void update(StrangerAccessRecordDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-03-19 + */ + void delete(String[] ids); + + /** + * @Description 陌生人根据地区编码查询附近网格数据接口定义 + * @Param CustomerGridListFormDTO + * @return Result> + * @Author wangc + * @Date 2020.03.19 14:28 + **/ + Result> listCustomerGrid(CustomerGridListFormDTO customerGridListFormDTO); + + /** + * 居民端-网格链接获取客户首页配置 + * @param + * @return void + * @author sun + */ + Result getgridhome(TokenDto tokenDTO, StrangerFormDTO formDTO); +} diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java new file mode 100644 index 0000000000..5858a5b795 --- /dev/null +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java @@ -0,0 +1,211 @@ +package com.epmet.service.impl; + + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.StrangerAccessRecordDao; +import com.epmet.dto.StrangerAccessRecordDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.CustomerGridForStrangerResultDTO; +import com.epmet.dto.result.HomeDesignByCustomerResultDTO; +import com.epmet.entity.StrangerAccessRecordEntity; +import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.feign.GovOrgFeignClient; +import com.epmet.feign.OperCustomizeFeignClient; +import com.epmet.service.StrangerAccessRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.tools.page.PageData; +import org.apache.commons.lang3.StringUtils; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Map; +/** + * @Description 陌生人记录访问表 + * @ClassName ResiGuideServiceImpl + * @Author wangc + * @date 2020.03.17 13:01 + */ +@Service +public class StrangerAccessRecordServiceImpl extends BaseServiceImpl implements StrangerAccessRecordService { + @Autowired + private StrangerAccessRecordDao strangerAccessRecordDao; + @Autowired + private GovOrgFeignClient govOrgFeignClient; + @Autowired + private EpmetUserFeignClient epmetUserFeignClient; + @Autowired + private OperCustomizeFeignClient operCustomizeFeignClient; + /** + * 查询陌生人访问记录 + * @param params + * @return PageData + * @author yangshaoping + * @date 2020-03-19 + */ + @Override + public PageData getStrangerAccessRecordPage(Map params) { + List list = strangerAccessRecordDao.getStrangerAccessRecordPage(params); + return getPageData(list,list.size(), StrangerAccessRecordDTO.class); + } + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, StrangerAccessRecordDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, StrangerAccessRecordDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public StrangerAccessRecordDTO get(String id) { + StrangerAccessRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, StrangerAccessRecordDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(StrangerAccessRecordDTO dto) { + StrangerAccessRecordEntity entity = ConvertUtils.sourceToTarget(dto, StrangerAccessRecordEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(StrangerAccessRecordDTO dto) { + StrangerAccessRecordEntity entity = ConvertUtils.sourceToTarget(dto, StrangerAccessRecordEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + + /** + * @Description 陌生人根据地区编码查询附近网格数据具体实现 + * @Param CustomerGridListFormDTO + * @return Result> + * @Author wangc + * @Date 2020.03.19 14:28 + **/ + + @Override + public Result> listCustomerGrid(CustomerGridListFormDTO customerGridListFormDTO) { + + + ListCustomerGridFormDTO listCustomerGridFormDTO = new ListCustomerGridFormDTO(); + listCustomerGridFormDTO.setAreaCode(0 == customerGridListFormDTO.getIsAuthorized() ? + customerGridListFormDTO.getSelectedAreaCode() : customerGridListFormDTO.getAreaCode()); + + listCustomerGridFormDTO.setPageNo(null == customerGridListFormDTO.getPageNo() ? 1 : customerGridListFormDTO.getPageNo()); + + listCustomerGridFormDTO.setPageSize(customerGridListFormDTO.getPageSize()); + + + Result> queryResult = + govOrgFeignClient + .getPageForStrangerGuideInterface(listCustomerGridFormDTO); + + //Feign调用成功 + if(queryResult.success()) { + + List queryList = queryResult.getData(); + if (null != queryResult && queryList.size() > 0) { + StrangerAccessRecordEntity strangerTrance = new StrangerAccessRecordEntity(); + //未授权,手动选择 + if (0 == customerGridListFormDTO.getIsAuthorized()) { + strangerTrance.setSelectedAreaCode(customerGridListFormDTO.getSelectedAreaCode()); + strangerTrance.setLocationAreaCode(""); + } else if (1 == customerGridListFormDTO.getIsAuthorized()) { + //已授权,自动选择 + strangerTrance.setLocationAreaCode(customerGridListFormDTO.getAreaCode()); + strangerTrance.setSelectedAreaCode(""); + } + strangerTrance.setIsAuthorized(customerGridListFormDTO.getIsAuthorized()); + strangerTrance.setGridNumber(queryList.size()); + strangerTrance.setVisitTime(new Date()); + strangerTrance.setProvince(customerGridListFormDTO.getProvince()); + strangerTrance.setCity(customerGridListFormDTO.getCity()); + strangerTrance.setArea(customerGridListFormDTO.getArea()); + insert(strangerTrance); + + return new Result>().ok(queryList); + } else { + //没有查询出结果 + return new Result>().ok(new ArrayList<>()); + } + }else{ + //Feign调用失败 + return new Result>().error(queryResult.getCode(),queryResult.getMsg()); + } + + + } + + /** + * 居民端-网格链接获取客户首页配置 + * @return void + * @author sun + */ + @Override + public Result getgridhome(TokenDto tokenDTO, StrangerFormDTO formDTO) { + //token里边有所属端 userId这些参数 前台传递customerID和gridId + //1:调用epmet-user服务查询数据 新建网格记录数据 + VisitedFormDTO vi = new VisitedFormDTO(); + vi.setGridId(formDTO.getGridId()); + vi.setCustomerId(formDTO.getCustomerId()); + vi.setUserId(tokenDTO.getUserId());//token中获取userId + epmetUserFeignClient.saveLatestAndVisited(vi); + + //2:调用ope-customize服务 获取首页发布数据 + Result res = getCustomerHomeData(formDTO.getCustomerId(),tokenDTO.getClient()); + return res; + + } + + /** + * 调用oper-customize服务 获取首页发布数据 + * @param customerId 客户Id + * @param clientType 所属端 + * @return + * @author sun + */ + public Result getCustomerHomeData(String customerId,String clientType){ + CustomerHomeFormDTO dto = new CustomerHomeFormDTO(); + dto.setCustomerId(customerId); + dto.setClientType(clientType);//居民端 + return operCustomizeFeignClient.getHomeReleaseByCustomer(dto); + } + + +} diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/resources/bootstrap.yml b/epmet-module/resi-guide/resi-guide-server/src/main/resources/bootstrap.yml index ebcd8b5647..2ff1d86886 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/resources/bootstrap.yml +++ b/epmet-module/resi-guide/resi-guide-server/src/main/resources/bootstrap.yml @@ -4,6 +4,8 @@ server: context-path: /resi/guide spring: + main: + allow-bean-definition-overriding: true application: name: resi-guide-server #环境 dev|test|prod diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/resources/logback-spring.xml b/epmet-module/resi-guide/resi-guide-server/src/main/resources/logback-spring.xml new file mode 100644 index 0000000000..6f0e508a90 --- /dev/null +++ b/epmet-module/resi-guide/resi-guide-server/src/main/resources/logback-spring.xml @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + debug + + + ${CONSOLE_LOG_PATTERN} + + UTF-8 + + + + + + + + ${log.path}/debug.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/debug-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + debug + ACCEPT + DENY + + + + + + + ${log.path}/info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/info-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + info + ACCEPT + DENY + + + + + + + ${log.path}/warn.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/warn-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + warn + ACCEPT + DENY + + + + + + + ${log.path}/error.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/error-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + ERROR + ACCEPT + DENY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/resources/mapper/StrangerAccessRecordDao.xml b/epmet-module/resi-guide/resi-guide-server/src/main/resources/mapper/StrangerAccessRecordDao.xml new file mode 100644 index 0000000000..ee340ac3e7 --- /dev/null +++ b/epmet-module/resi-guide/resi-guide-server/src/main/resources/mapper/StrangerAccessRecordDao.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerUserDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerUserDTO.java index 348dc373d2..2964c379c3 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerUserDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerUserDTO.java @@ -48,6 +48,11 @@ public class CustomerUserDTO implements Serializable { */ private String wxOpenId; + /** + * 微信unionId + */ + private String unionId; + /** * 手机号 */ @@ -118,4 +123,4 @@ public class CustomerUserDTO implements Serializable { */ private Date updatedTime; -} \ No newline at end of file +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridLatestDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridLatestDTO.java new file mode 100644 index 0000000000..98a6176f5f --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridLatestDTO.java @@ -0,0 +1,101 @@ +/** + * 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.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Data +public class GridLatestDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 客户Id CUSTOMER.id + */ + private String customerId; + + /** + * 网格表Id(CUSTOMER_GRID.id) + */ + private String gridId; + + /** + * 用户Id(CUSTOMER_USER.id) + */ + private String customerUserId; + + /** + * 所属地区码 (数据统计字段) + */ + private String areaCode; + + /** + * 上级组织ID (数据统计字段) + */ + private String pid; + + /** + * 最近访问时间 + */ + private Date latestTime; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridVisitedDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridVisitedDTO.java new file mode 100644 index 0000000000..72eea402f8 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridVisitedDTO.java @@ -0,0 +1,96 @@ +/** + * 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.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 网格访问记录表 用户对网格访问的一个记录,只有在访问网格首页时才存储数据,一个用户一天对一个网格的访问只有一条记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Data +public class GridVisitedDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 是否注册(0:否 1:是) + */ + private Integer isRegister; + + /** + * 客户ID + */ + private String customerId; + + /** + * 网格表Id (CUSTOMER_GRID.id) + */ + private String gridId; + + /** + * 用户Id + */ + private String customerUserId; + + /** + * 访问时间 一个用户一天访问一个网格只有一条记录 + */ + private Date visitTime; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VisitedFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VisitedFormDTO.java new file mode 100644 index 0000000000..c8bacca5f9 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VisitedFormDTO.java @@ -0,0 +1,52 @@ +/** + * 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.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 居民端-网格链接获取客户首页配置 + * @author sun + */ +@Data +public class VisitedFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 网格Id + */ + @NotBlank(message = "网格ID不能为空") + private String gridId; + /** + * 客户Id CUSTOMER.id + */ + @NotBlank(message = "客户ID不能为空") + private String customerId; + /** + * 用户Id + */ + @NotBlank(message = "用户ID不能为空") + private String userId; + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index 020b93702c..fbca8c6fdb 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -64,6 +64,12 @@ io.github.openfeign feign-httpclient + + com.epmet + gov-org-client + 2.0.0 + compile + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/UserApplication.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/UserApplication.java index 31ded63d9e..8f8e583add 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/UserApplication.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/UserApplication.java @@ -19,6 +19,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients; * @author Mark sunlightcs@gmail.com * @since 1.0.0 */ + @SpringBootApplication @EnableDiscoveryClient @EnableFeignClients diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PdmanDbVersionController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java similarity index 65% rename from epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PdmanDbVersionController.java rename to epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java index 00851cdb80..a6c1500b02 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PdmanDbVersionController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java @@ -25,9 +25,9 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; -import com.epmet.dto.PdmanDbVersionDTO; -import com.epmet.excel.PdmanDbVersionExcel; -import com.epmet.service.PdmanDbVersionService; +import com.epmet.dto.GridLatestDTO; +import com.epmet.excel.GridLatestExcel; +import com.epmet.service.GridLatestService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -37,43 +37,43 @@ import java.util.Map; /** - * + * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-16 */ @RestController -@RequestMapping("pdmandbversion") -public class PdmanDbVersionController { +@RequestMapping("gridlatest") +public class GridLatestController { @Autowired - private PdmanDbVersionService pdmanDbVersionService; + private GridLatestService gridLatestService; @GetMapping("page") - public Result> page(@RequestParam Map params){ - PageData page = pdmanDbVersionService.page(params); - return new Result>().ok(page); + public Result> page(@RequestParam Map params){ + PageData page = gridLatestService.page(params); + return new Result>().ok(page); } @GetMapping("{id}") - public Result get(@PathVariable("id") String id){ - PdmanDbVersionDTO data = pdmanDbVersionService.get(id); - return new Result().ok(data); + public Result get(@PathVariable("id") String id){ + GridLatestDTO data = gridLatestService.get(id); + return new Result().ok(data); } @PostMapping - public Result save(@RequestBody PdmanDbVersionDTO dto){ + public Result save(@RequestBody GridLatestDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); - pdmanDbVersionService.save(dto); + gridLatestService.save(dto); return new Result(); } @PutMapping - public Result update(@RequestBody PdmanDbVersionDTO dto){ + public Result update(@RequestBody GridLatestDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); - pdmanDbVersionService.update(dto); + gridLatestService.update(dto); return new Result(); } @@ -81,14 +81,14 @@ public class PdmanDbVersionController { public Result delete(@RequestBody String[] ids){ //效验数据 AssertUtils.isArrayEmpty(ids, "id"); - pdmanDbVersionService.delete(ids); + gridLatestService.delete(ids); return new Result(); } @GetMapping("export") public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { - List list = pdmanDbVersionService.list(params); - ExcelUtils.exportExcelToTarget(response, null, list, PdmanDbVersionExcel.class); + List list = gridLatestService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, GridLatestExcel.class); } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridVisitedController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridVisitedController.java new file mode 100644 index 0000000000..1f3d09d73c --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridVisitedController.java @@ -0,0 +1,106 @@ +/** + * 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.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.GridVisitedDTO; +import com.epmet.dto.form.VisitedFormDTO; +import com.epmet.excel.GridVisitedExcel; +import com.epmet.service.GridVisitedService; +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 generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@RestController +@RequestMapping("gridvisited") +public class GridVisitedController { + + @Autowired + private GridVisitedService gridVisitedService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = gridVisitedService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + GridVisitedDTO data = gridVisitedService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody GridVisitedDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + gridVisitedService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody GridVisitedDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + gridVisitedService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + gridVisitedService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = gridVisitedService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, GridVisitedExcel.class); + } + + /** + * 网格访问记录表、最近访问网格表新增数据 + * 网格访问记录表新增数据(一天一条) + * 最近访问表更新访问时间字段 + * @param formDTO + */ + @PostMapping("savelatestandvisited") + public void saveLatestAndVisited(@RequestBody VisitedFormDTO formDTO) throws Exception { + gridVisitedService.saveLatestAndVisited(formDTO); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/PdmanDbVersionDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java similarity index 71% rename from epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/PdmanDbVersionDao.java rename to epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java index 44b4dc43da..52af37226a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/PdmanDbVersionDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java @@ -18,16 +18,18 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.entity.PdmanDbVersionEntity; +import com.epmet.dto.GridLatestDTO; +import com.epmet.entity.GridLatestEntity; import org.apache.ibatis.annotations.Mapper; /** - * + * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-16 */ @Mapper -public interface PdmanDbVersionDao extends BaseDao { - +public interface GridLatestDao extends BaseDao { + + GridLatestEntity getGridLatestByIds(GridLatestDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridVisitedDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridVisitedDao.java new file mode 100644 index 0000000000..b246bdabd5 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridVisitedDao.java @@ -0,0 +1,37 @@ +/** + * 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.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.GridLatestDTO; +import com.epmet.dto.GridVisitedDTO; +import com.epmet.entity.GridLatestEntity; +import com.epmet.entity.GridVisitedEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 网格访问记录表 用户对网格访问的一个记录,只有在访问网格首页时才存储数据,一个用户一天对一个网格的访问只有一条记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Mapper +public interface GridVisitedDao extends BaseDao { + + GridVisitedDTO getGridVisitedByIds(GridVisitedDTO formDTO); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerUserEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerUserEntity.java index 11a6e86b09..9b93cd7ee3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerUserEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerUserEntity.java @@ -48,6 +48,11 @@ public class CustomerUserEntity extends BaseEpmetEntity { */ private String wxOpenId; + /** + * 微信unionId + */ + private String unionId; + /** * 手机号 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridLatestEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridLatestEntity.java new file mode 100644 index 0000000000..254829c16f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridLatestEntity.java @@ -0,0 +1,71 @@ +/** + * 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.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("grid_latest") +public class GridLatestEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id CUSTOMER.id + */ + private String customerId; + + /** + * 网格表Id(CUSTOMER_GRID.id) + */ + private String gridId; + + /** + * 用户Id(CUSTOMER_USER.id) + */ + private String customerUserId; + + /** + * 所属地区码 (数据统计字段) + */ + private String areaCode; + + /** + * 上级组织ID (数据统计字段) + */ + private String pid; + + /** + * 最近访问时间 + */ + private Date latestTime; + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/PdmanDbVersionEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridVisitedEntity.java similarity index 64% rename from epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/PdmanDbVersionEntity.java rename to epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridVisitedEntity.java index 9a9e181918..a6cb62c704 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/PdmanDbVersionEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridVisitedEntity.java @@ -26,26 +26,41 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * + * 网格访问记录表 用户对网格访问的一个记录,只有在访问网格首页时才存储数据,一个用户一天对一个网格的访问只有一条记录 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-16 */ @Data @EqualsAndHashCode(callSuper=false) -@TableName("pdman_db_version") -public class PdmanDbVersionEntity extends BaseEpmetEntity { +@TableName("grid_visited") +public class GridVisitedEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; /** - * + * 是否注册(0:否 1:是) */ - private String dbVersion; + private Integer isRegister; /** - * + * 客户ID */ - private String versionDesc; + private String customerId; + + /** + * 网格表Id (CUSTOMER_GRID.id) + */ + private String gridId; + + /** + * 用户Id + */ + private String customerUserId; + + /** + * 访问时间 一个用户一天访问一个网格只有一条记录 + */ + private Date visitTime; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GridLatestExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GridLatestExcel.java new file mode 100644 index 0000000000..e4d6000914 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GridLatestExcel.java @@ -0,0 +1,74 @@ +/** + * 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.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Data +public class GridLatestExcel { + + @Excel(name = "唯一标识") + private String id; + + @Excel(name = "客户Id CUSTOMER.id") + private String customerId; + + @Excel(name = "网格表Id(CUSTOMER_GRID.id)") + private String gridId; + + @Excel(name = "用户Id(CUSTOMER_USER.id)") + private String customerUserId; + + @Excel(name = "所属地区码 (数据统计字段)") + private String areaCode; + + @Excel(name = "上级组织ID (数据统计字段)") + private String pid; + + @Excel(name = "最近访问时间") + private Date latestTime; + + @Excel(name = "删除标识:0.未删除 1.已删除") + private Integer 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; + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GridVisitedExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GridVisitedExcel.java new file mode 100644 index 0000000000..9e3e61b72b --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GridVisitedExcel.java @@ -0,0 +1,71 @@ +/** + * 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.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 网格访问记录表 用户对网格访问的一个记录,只有在访问网格首页时才存储数据,一个用户一天对一个网格的访问只有一条记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Data +public class GridVisitedExcel { + + @Excel(name = "唯一标识") + private String id; + + @Excel(name = "是否注册(0:否 1:是)") + private Integer isRegister; + + @Excel(name = "客户ID") + private String customerId; + + @Excel(name = "网格表Id (CUSTOMER_GRID.id)") + private String gridId; + + @Excel(name = "用户Id") + private String customerUserId; + + @Excel(name = "访问时间 一个用户一天访问一个网格只有一条记录") + private Date visitTime; + + @Excel(name = "删除标识:0.未删除 1.已删除") + private Integer 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; + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java new file mode 100644 index 0000000000..5625a3ee76 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -0,0 +1,27 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.feign.fallback.GovOrgFeignClientFallBack; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; + +/** + * @Description 居民端陌生人导览 调用gov-org服务 + * @Author sun + * @Date 2020/3/16 + */ +@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallBack.class) +public interface GovOrgFeignClient { + + /** + * @param + * @Description 根据客户Id查询客户用户表数据 + * @Date 2020/3/17 + **/ + @PostMapping("/gov/org/customergrid/getcustomergridbygridid") + Result getCustomerGridByGridId(CustomerGridFormDTO formDTO); + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java new file mode 100644 index 0000000000..c5e04129bf --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java @@ -0,0 +1,23 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.feign.GovOrgFeignClient; +import org.springframework.stereotype.Component; + +/** + * @Description 居民端-陌生人导览 调用gov-org服务 + * @Author sun + * @Date 2020/3/16 + */ +@Component +public class GovOrgFeignClientFallBack implements GovOrgFeignClient { + + @Override + public Result getCustomerGridByGridId(CustomerGridFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getCustomerGridByGridId",formDTO); + } +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/PdmanDbVersionRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridLatestRedis.java similarity index 85% rename from epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/PdmanDbVersionRedis.java rename to epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridLatestRedis.java index df050721f3..41bf0cfb49 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/PdmanDbVersionRedis.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridLatestRedis.java @@ -22,13 +22,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** - * + * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-16 */ @Component -public class PdmanDbVersionRedis { +public class GridLatestRedis { @Autowired private RedisUtils redisUtils; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridVisitedRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridVisitedRedis.java new file mode 100644 index 0000000000..9316d6f3c7 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridVisitedRedis.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.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 网格访问记录表 用户对网格访问的一个记录,只有在访问网格首页时才存储数据,一个用户一天对一个网格的访问只有一条记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Component +public class GridVisitedRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PdmanDbVersionService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java similarity index 66% rename from epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PdmanDbVersionService.java rename to epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java index 2b869d27c9..138f4c9483 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PdmanDbVersionService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java @@ -19,49 +19,51 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; -import com.epmet.dto.PdmanDbVersionDTO; -import com.epmet.entity.PdmanDbVersionEntity; +import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.GridLatestDTO; +import com.epmet.dto.form.VisitedFormDTO; +import com.epmet.entity.GridLatestEntity; import java.util.List; import java.util.Map; /** - * + * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-16 */ -public interface PdmanDbVersionService extends BaseService { +public interface GridLatestService extends BaseService { /** * 默认分页 * * @param params - * @return PageData + * @return PageData * @author generator * @date 2020-03-16 */ - PageData page(Map params); + PageData page(Map params); /** * 默认查询 * * @param params - * @return java.util.List + * @return java.util.List * @author generator * @date 2020-03-16 */ - List list(Map params); + List list(Map params); /** * 单条查询 * * @param id - * @return PdmanDbVersionDTO + * @return GridLatestDTO * @author generator * @date 2020-03-16 */ - PdmanDbVersionDTO get(String id); + GridLatestDTO get(String id); /** * 默认保存 @@ -71,7 +73,7 @@ public interface PdmanDbVersionService extends BaseService * @author generator * @date 2020-03-16 */ - void save(PdmanDbVersionDTO dto); + void save(GridLatestDTO dto); /** * 默认更新 @@ -81,7 +83,7 @@ public interface PdmanDbVersionService extends BaseService * @author generator * @date 2020-03-16 */ - void update(PdmanDbVersionDTO dto); + void update(GridLatestDTO dto); /** * 批量删除 @@ -92,4 +94,10 @@ public interface PdmanDbVersionService extends BaseService * @date 2020-03-16 */ void delete(String[] ids); + + /** + * 最近访问网格表新增数据 + * @param formDTO + */ + void saveGridLatest(VisitedFormDTO formDTO, CustomerGridDTO cu); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridVisitedService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridVisitedService.java new file mode 100644 index 0000000000..b324356f94 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridVisitedService.java @@ -0,0 +1,117 @@ +/** + * 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.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.GridLatestDTO; +import com.epmet.dto.GridVisitedDTO; +import com.epmet.dto.form.VisitedFormDTO; +import com.epmet.entity.GridVisitedEntity; + +import java.util.List; +import java.util.Map; + +/** + * 网格访问记录表 用户对网格访问的一个记录,只有在访问网格首页时才存储数据,一个用户一天对一个网格的访问只有一条记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +public interface GridVisitedService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-03-16 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-03-16 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return GridVisitedDTO + * @author generator + * @date 2020-03-16 + */ + GridVisitedDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-16 + */ + void save(GridVisitedDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-16 + */ + void update(GridVisitedDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-03-16 + */ + void delete(String[] ids); + + + + + + + /** + * 网格访问记录表新增数据 + * @param formDTO + */ + //void saveGridVisited(GridVisitedDTO formDTO); + + + + + + /** + * @param formDTO + */ + void saveLatestAndVisited(VisitedFormDTO formDTO) throws Exception; +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java new file mode 100644 index 0000000000..ba4dcea6a1 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java @@ -0,0 +1,136 @@ +/** + * 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.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.GridLatestDao; +import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.GridLatestDTO; +import com.epmet.dto.form.VisitedFormDTO; +import com.epmet.entity.GridLatestEntity; +import com.epmet.redis.GridLatestRedis; +import com.epmet.service.GridLatestService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Service +public class GridLatestServiceImpl extends BaseServiceImpl implements GridLatestService { + + @Autowired + private GridLatestRedis gridLatestRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, GridLatestDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, GridLatestDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public GridLatestDTO get(String id) { + GridLatestEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, GridLatestDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(GridLatestDTO dto) { + GridLatestEntity entity = ConvertUtils.sourceToTarget(dto, GridLatestEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(GridLatestDTO dto) { + GridLatestEntity entity = ConvertUtils.sourceToTarget(dto, GridLatestEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void saveGridLatest(VisitedFormDTO formDTO, CustomerGridDTO cu) { + Date date = new Date(); + GridLatestDTO la = new GridLatestDTO(); + la.setCustomerId(cu.getCustomerId()); + la.setGridId(cu.getId()); + //la.setCustomerUserId(formDTO.getUserId());//token传递的值 + la.setCustomerUserId("1111111111");//token传递的值 + la.setAreaCode(cu.getAreaCode()); + la.setPid(cu.getPid()); + la.setLatestTime(date); + la.setUpdatedTime(date); + //查询是否存在历史数据(一个用户对一个网格的访问只记录一条数据) + GridLatestEntity dto = baseDao.getGridLatestByIds(la); + GridLatestEntity entity = null; + if(dto==null||dto.getId()==null){ + entity = ConvertUtils.sourceToTarget(la, GridLatestEntity.class); + insert(entity); + }else{ + entity = ConvertUtils.sourceToTarget(dto, GridLatestEntity.class); + entity.setLatestTime(date);//最近访问时间 + entity.setUpdatedTime(date); + updateById(entity); + } + + } + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridVisitedServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridVisitedServiceImpl.java new file mode 100644 index 0000000000..a3810e7268 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridVisitedServiceImpl.java @@ -0,0 +1,174 @@ +/** + * 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.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.GridVisitedDao; +import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.GridVisitedDTO; +import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.form.VisitedFormDTO; +import com.epmet.entity.GridVisitedEntity; +import com.epmet.feign.GovOrgFeignClient; +import com.epmet.service.GridLatestService; +import com.epmet.service.GridVisitedService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * 网格访问记录表 用户对网格访问的一个记录,只有在访问网格首页时才存储数据,一个用户一天对一个网格的访问只有一条记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Service +public class GridVisitedServiceImpl extends BaseServiceImpl implements GridVisitedService { + + @Autowired + private GovOrgFeignClient govOrgFeignClient; + @Autowired + private GridLatestService gridLatestService; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, GridVisitedDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, GridVisitedDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public GridVisitedDTO get(String id) { + GridVisitedEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, GridVisitedDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(GridVisitedDTO dto) { + GridVisitedEntity entity = ConvertUtils.sourceToTarget(dto, GridVisitedEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(GridVisitedDTO dto) { + GridVisitedEntity entity = ConvertUtils.sourceToTarget(dto, GridVisitedEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * 网格记录表新增数据 + * @author sun + * @param formDTO + * @throws Exception + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void saveLatestAndVisited(VisitedFormDTO formDTO) throws Exception { + //1:调用gov-org服务 查询客户网格表数据 + CustomerGridFormDTO dto = new CustomerGridFormDTO(); + dto.setGridId(formDTO.getGridId()); + Result result = govOrgFeignClient.getCustomerGridByGridId(dto); + if(!result.success()){ + throw new Exception("查询客户网格表数据失败!"); + } + CustomerGridDTO cu = result.getData(); + + //2:网格访问记录表新增数据 + saveGridVisited(formDTO,cu); + + //3:最近访问网格表新增数据 + gridLatestService.saveGridLatest(formDTO,cu); + + } + + /** + * 网格记录表和最近访问网格表新增数据 + * @param formDTO + * @param cu + */ + public void saveGridVisited(VisitedFormDTO formDTO,CustomerGridDTO cu) { + Date date = new Date(); + GridVisitedDTO vi = new GridVisitedDTO(); + vi.setIsRegister(getRegister("0"));//后续再其他服务中获取这个状态值 + vi.setCustomerId(cu.getCustomerId()); + vi.setGridId(cu.getId()); + vi.setCustomerUserId(formDTO.getUserId()); + vi.setVisitTime(date); + vi.setUpdatedTime(date); + //查询是否存在历史数据( 一个用户一天对一个网格只存在一条访问记录) + GridVisitedDTO dto = baseDao.getGridVisitedByIds(vi); + GridVisitedEntity entity = null; + if(dto==null||dto.getId()==null){ + entity = ConvertUtils.sourceToTarget(vi, GridVisitedEntity.class); + insert(entity); + }else{ + entity = ConvertUtils.sourceToTarget(dto, GridVisitedEntity.class); + entity.setUpdatedTime(date); + updateById(entity); + } + } + + /** + * (预留方法)查询是否注册状态值 + * @param str + * @return + */ + public Integer getRegister(String str){ + return 0; + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerUserDao.xml index 09dbe55a56..4841a86795 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerUserDao.xml @@ -3,26 +3,6 @@ - - - - - - - - - - - - - - - - - - - - + SELECT + la.id, + la.customer_id, + la.grid_id, + la.customer_user_id, + la.area_code, + la.pid, + la.latest_time, + la.del_flag, + la.revision, + la.created_by, + la.created_time, + la.updated_by, + la.updated_time + FROM grid_latest la + WHERE + la.del_flag = '0' + + AND la.customer_id = #{customerId} + + + AND la.grid_id = #{gridId} + + + AND la.customer_user_id = #{customerUserId} + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GridVisitedDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GridVisitedDao.xml new file mode 100644 index 0000000000..12c9ebcfeb --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GridVisitedDao.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file