From be1b426b7d765a546f4a26b60e80aa49a57079b9 Mon Sep 17 00:00:00 2001
From: xiaogang <905166056@qq.com>
Date: 星期六, 13 一月 2024 16:25:11 +0800
Subject: [PATCH] 1、优化采购模块数量不能为小数点问题2、新增客服巡查巡楼记录功能模块3、新增页面导出功能4、优化记录查询条件新增时间段查询条件5、其他界面性调整
---
service-user/src/main/java/com/java110/user/cmd/owner/EditOwnerCmd.java | 119 +++++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 78 insertions(+), 41 deletions(-)
diff --git a/service-user/src/main/java/com/java110/user/cmd/owner/EditOwnerCmd.java b/service-user/src/main/java/com/java110/user/cmd/owner/EditOwnerCmd.java
index 4f289ff..eabd9ae 100644
--- a/service-user/src/main/java/com/java110/user/cmd/owner/EditOwnerCmd.java
+++ b/service-user/src/main/java/com/java110/user/cmd/owner/EditOwnerCmd.java
@@ -9,21 +9,21 @@
import com.java110.core.event.cmd.CmdEvent;
import com.java110.core.factory.GenerateCodeFactory;
import com.java110.doc.annotation.*;
+import com.java110.dto.account.AccountDto;
import com.java110.dto.file.FileDto;
import com.java110.dto.file.FileRelDto;
import com.java110.dto.owner.OwnerAppUserDto;
import com.java110.dto.owner.OwnerDto;
+import com.java110.intf.acct.IAccountInnerServiceSMO;
import com.java110.intf.common.IFileInnerServiceSMO;
import com.java110.intf.common.IFileRelInnerServiceSMO;
-import com.java110.intf.user.IOwnerV1InnerServiceSMO;
-import com.java110.intf.user.IOwnerAppUserInnerServiceSMO;
-import com.java110.intf.user.IOwnerAppUserV1InnerServiceSMO;
-import com.java110.intf.user.IOwnerAttrInnerServiceSMO;
-import com.java110.intf.user.IOwnerInnerServiceSMO;
+import com.java110.intf.user.*;
+import com.java110.po.account.AccountPo;
import com.java110.po.file.FileRelPo;
import com.java110.po.owner.OwnerAppUserPo;
import com.java110.po.owner.OwnerAttrPo;
import com.java110.po.owner.OwnerPo;
+import com.java110.po.user.UserPo;
import com.java110.utils.cache.MappingCache;
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.Assert;
@@ -41,8 +41,7 @@
resource = "userDoc",
author = "鍚村鏂�",
serviceCode = "owner.editOwner",
- seq = 10
-)
+ seq = 10)
@Java110ParamsDoc(params = {
@Java110ParamDoc(name = "communityId", length = 30, remark = "灏忓尯ID"),
@@ -61,11 +60,10 @@
params = {
@Java110ParamDoc(name = "code", type = "int", length = 11, defaultValue = "0", remark = "杩斿洖缂栧彿锛�0 鎴愬姛 鍏朵粬澶辫触"),
@Java110ParamDoc(name = "msg", type = "String", length = 250, defaultValue = "鎴愬姛", remark = "鎻忚堪"),
- }
-)
+ })
@Java110ExampleDoc(
- reqBody="{\n" +
+ reqBody = "{\n" +
"\t\"name\": \"鐜嬬帇\",\n" +
"\t\"age\": \"\",\n" +
"\t\"link\": \"18909718888\",\n" +
@@ -78,7 +76,7 @@
"\t\"idCard\": \"\",\n" +
"\t\"communityId\": \"2022121921870161\"\n" +
"}",
- resBody="{\"code\":0,\"msg\":\"鎴愬姛\"}"
+ resBody = "{\"code\":0,\"msg\":\"鎴愬姛\"}"
)
@Java110Cmd(serviceCode = "owner.editOwner")
public class EditOwnerCmd extends Cmd {
@@ -104,6 +102,12 @@
@Autowired
private IFileInnerServiceSMO fileInnerServiceSMOImpl;
+ @Autowired
+ private IAccountInnerServiceSMO accountInnerServiceSMOImpl;
+
+ @Autowired
+ private IUserV1InnerServiceSMO userV1InnerServiceSMOImpl;
+
@Override
public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
Assert.jsonObjectHaveKey(reqJson, "memberId", "璇锋眰鎶ユ枃涓湭鍖呭惈ownerId");
@@ -115,7 +119,6 @@
Assert.jsonObjectHaveKey(reqJson, "communityId", "璇锋眰鎶ユ枃涓湭鍖呭惈communityId");
// Assert.jsonObjectHaveKey(paramIn, "idCard", "璇锋眰鎶ユ枃涓湭鍖呭惈韬唤璇佸彿");
Assert.judgeAttrValue(reqJson);
-
//鑾峰彇鎵嬫満鍙�(鍒ゆ柇鎵嬫満鍙锋槸鍚﹂噸澶�)
String link = reqJson.getString("link");
if (!StringUtil.isEmpty(link) && link.contains("*")) {
@@ -130,7 +133,6 @@
}
//鑾峰彇韬唤璇佸彿(鍒ゆ柇韬唤璇佸彿鏄惁閲嶅)
String idCard = reqJson.getString("idCard");
-
if (!StringUtil.isEmpty(idCard) && idCard.contains("*")) {
OwnerDto owner = new OwnerDto();
owner.setOwnerId(reqJson.getString("ownerId"));
@@ -141,13 +143,10 @@
idCard = owners.get(0).getIdCard();
reqJson.put("idCard", idCard);
}
-
String userValidate = MappingCache.getValue("USER_VALIDATE");
-
if (!"ON".equals(userValidate)) {
return;
}
-
OwnerDto ownerDto = new OwnerDto();
ownerDto.setLink(link);
ownerDto.setCommunityId(reqJson.getString("communityId"));
@@ -184,7 +183,6 @@
if (!reqJson.containsKey("ownerId") || OwnerDto.OWNER_TYPE_CD_OWNER.equals(reqJson.getString("ownerTypeCd"))) {
reqJson.put("ownerId", reqJson.getString("memberId"));
}
-
//杩欓噷娉ㄩ噴 鍥犱负 鏈夊浗澶栫殑鎵嬫満鍙� 涓嶆槸11浣�
// if (link.length() != 11) {
// throw new IllegalArgumentException("鎵嬫満鍙疯緭鍏ヤ笉姝g‘锛�");
@@ -192,9 +190,10 @@
if (reqJson.containsKey("ownerPhoto") && !StringUtils.isEmpty(reqJson.getString("ownerPhoto"))) {
editOwnerPhoto(reqJson);
}
+ //todo 淇敼 涓氫富淇℃伅
editOwner(reqJson);
JSONArray attrs = reqJson.getJSONArray("attrs");
- if (attrs == null && attrs.size() < 1) {
+ if (attrs == null || attrs.size() < 1) {
return;
}
JSONObject attr = null;
@@ -218,20 +217,18 @@
throw new CmdException("淇敼涓氫富灞炴�уけ璐�");
}
}
+ //todo 濡傛灉 涓氫富鍋氫簡缁戝畾鍒欎慨鏀圭粦瀹氱殑鎵嬫満鍙�
+ updateOwnerAppUser(reqJson);
}
public void editOwner(JSONObject paramInJson) {
-
OwnerDto ownerDto = new OwnerDto();
ownerDto.setMemberId(paramInJson.getString("memberId"));
List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwnerMembers(ownerDto);
-
Assert.listOnlyOne(ownerDtos, "鏈煡璇㈠埌涓氫富淇℃伅鎴栨煡璇㈠埌澶氭潯");
-
JSONObject businessOwner = new JSONObject();
businessOwner.putAll(BeanConvertUtil.beanCovertMap(ownerDtos.get(0)));
businessOwner.putAll(paramInJson);
-
if (paramInJson.containsKey("wxPhoto")) {
businessOwner.put("link", paramInJson.getString("wxPhoto"));
}
@@ -244,28 +241,39 @@
if (flag < 1) {
throw new CmdException("淇敼涓氫富澶辫触");
}
- OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto();
- ownerAppUserDto.setMemberId(paramInJson.getString("ownerId"));
-
- //鏌ヨapp鐢ㄦ埛琛�
- List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserInnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto);
- if (ownerAppUserDtos != null && ownerAppUserDtos.size() > 0) {
- for (OwnerAppUserDto ownerAppUser : ownerAppUserDtos) {
- OwnerAppUserPo ownerAppUserPo = BeanConvertUtil.covertBean(ownerAppUser, OwnerAppUserPo.class);
- ownerAppUserPo.setLink(paramInJson.getString("link"));
- ownerAppUserPo.setIdCard(paramInJson.getString("idCard"));
- flag = ownerAppUserV1InnerServiceSMOImpl.updateOwnerAppUser(ownerAppUserPo);
- if (flag < 1) {
- throw new CmdException("淇敼涓氫富澶辫触");
- }
- }
+ //todo 鍒ゆ柇涓氫富鎵嬫満鍙峰拰璐︽埛鎵嬫満鍙锋槸鍚︾浉鍚岋紝涓嶇浉鍚屼慨鏀硅处鎴锋墜鏈哄彿
+ AccountDto accountDto = new AccountDto();
+ accountDto.setObjId(ownerDtos.get(0).getMemberId());
+ accountDto.setPartId(ownerDtos.get(0).getCommunityId());
+ List<AccountDto> accountDtos = accountInnerServiceSMOImpl.queryAccounts(accountDto);
+ if (accountDtos == null || accountDtos.size() < 1) {
+ return;
}
+ //鏌ヨ鏇存柊鍚庣殑涓氫富淇℃伅
+ OwnerDto owner = new OwnerDto();
+ owner.setMemberId(paramInJson.getString("memberId"));
+ List<OwnerDto> owners = ownerInnerServiceSMOImpl.queryOwnerMembers(owner);
+ Assert.listOnlyOne(owners, "鏈煡璇㈠埌涓氫富淇℃伅鎴栨煡璇㈠埌澶氭潯");
+ /*if (accountDtos.get(0).getLink().equals(ownerDtos.get(0).getLink())) {
+ return;
+ }*/
+ if (!accountDtos.get(0).getLink().equals(owners.get(0).getLink()) || !accountDtos.get(0).getAcctName().equals(owners.get(0).getName())) {
+ AccountPo accountPo = new AccountPo();
+ accountPo.setAcctName(owners.get(0).getName());
+ accountPo.setLink(owners.get(0).getLink());
+ accountPo.setAcctId(accountDtos.get(0).getAcctId());
+ accountInnerServiceSMOImpl.updateAccount(accountPo);
+ }
+
+ AccountPo accountPo = new AccountPo();
+ accountPo.setoLink(ownerDtos.get(0).getLink());
+ accountPo.setAcctId(accountDtos.get(0).getAcctId());
+ accountInnerServiceSMOImpl.updateAccount(accountPo);
}
public void editOwnerPhoto(JSONObject paramInJson) {
-
String _photo = paramInJson.getString("ownerPhoto");
- if(_photo.length()> 512){
+ if (_photo.length() > 512) {
FileDto fileDto = new FileDto();
fileDto.setFileId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_file_id));
fileDto.setFileName(fileDto.getFileId());
@@ -274,7 +282,6 @@
fileDto.setCommunityId(paramInJson.getString("communityId"));
_photo = fileInnerServiceSMOImpl.saveFile(fileDto);
}
-
FileRelDto fileRelDto = new FileRelDto();
fileRelDto.setRelTypeCd("10000");
fileRelDto.setObjId(paramInJson.getString("memberId"));
@@ -295,7 +302,6 @@
}
return;
}
-
JSONObject businessUnit = new JSONObject();
businessUnit.putAll(BeanConvertUtil.beanCovertMap(fileRelDtos.get(0)));
businessUnit.put("fileRealName", _photo);
@@ -306,4 +312,35 @@
throw new CmdException("淇濆瓨鏂囦欢澶辫触");
}
}
+
+ /**
+ * 濡傛灉 涓氫富鍋氫簡缁戝畾鍒欎慨鏀圭粦瀹氱殑鎵嬫満鍙�
+ *
+ * @param reqJson
+ */
+ private void updateOwnerAppUser(JSONObject reqJson) {
+ OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto();
+ ownerAppUserDto.setMemberId(reqJson.getString("memberId"));
+ //todo 鏌ヨapp鐢ㄦ埛琛�
+ List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserInnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto);
+ if (ownerAppUserDtos == null || ownerAppUserDtos.size() < 1) {
+ return;
+ }
+ for (OwnerAppUserDto ownerAppUser : ownerAppUserDtos) {
+ OwnerAppUserPo ownerAppUserPo = BeanConvertUtil.covertBean(ownerAppUser, OwnerAppUserPo.class);
+ ownerAppUserPo.setLink(reqJson.getString("link"));
+ ownerAppUserV1InnerServiceSMOImpl.updateOwnerAppUser(ownerAppUserPo);
+ if (StringUtil.isEmpty(ownerAppUser.getUserId())) {
+ continue;
+ }
+ if (ownerAppUser.getUserId().startsWith("-")) {
+ continue;
+ }
+ // todo 淇敼鐢ㄦ埛淇℃伅
+ UserPo userPo = new UserPo();
+ userPo.setUserId(ownerAppUserDtos.get(0).getUserId());
+ userPo.setTel(reqJson.getString("link"));
+ userV1InnerServiceSMOImpl.updateUser(userPo);
+ }
+ }
}
--
Gitblit v1.8.0