Commit efa6bbd9 authored by 黎聪聪's avatar 黎聪聪

2020年11月2日 17:10:24

parent ccb08de4
...@@ -82,6 +82,7 @@ public class ConsultSheet extends UserSheet implements Serializable { ...@@ -82,6 +82,7 @@ public class ConsultSheet extends UserSheet implements Serializable {
/* 订单id */ /* 订单id */
private Long orderId; private Long orderId;
private String appId;
public ConsultSheet() { public ConsultSheet() {
this.delFlag = false; this.delFlag = false;
this.status = "0"; this.status = "0";
......
...@@ -33,5 +33,5 @@ public interface ConsultSheetService extends GenericService<ConsultSheet> { ...@@ -33,5 +33,5 @@ public interface ConsultSheetService extends GenericService<ConsultSheet> {
* @Param * @Param
* @return * @return
**/ **/
JSONObject consultSheetList(String name,Long id); JSONObject consultSheetList(String name,Long id,String appId);
} }
...@@ -2,6 +2,8 @@ package com.cftech.consultsheet.service.impl; ...@@ -2,6 +2,8 @@ package com.cftech.consultsheet.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cftech.accounts.model.MpAccountsEntity;
import com.cftech.accounts.service.MpAccountsService;
import com.cftech.base.codingrule.utils.CodingruleUtils; import com.cftech.base.codingrule.utils.CodingruleUtils;
import com.cftech.base.org.model.Qyuser; import com.cftech.base.org.model.Qyuser;
import com.cftech.base.org.service.QyuserService; import com.cftech.base.org.service.QyuserService;
...@@ -38,7 +40,8 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im ...@@ -38,7 +40,8 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im
@Autowired @Autowired
@Qualifier("consultSheetMapper") @Qualifier("consultSheetMapper")
private ConsultSheetMapper consultSheetMapper; private ConsultSheetMapper consultSheetMapper;
@Autowired
private MpAccountsService mpAccountsService;
@Autowired @Autowired
private OrderService orderService; private OrderService orderService;
...@@ -51,7 +54,7 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im ...@@ -51,7 +54,7 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im
@Autowired @Autowired
private CodingruleUtils codingruleUtils; private CodingruleUtils codingruleUtils;
static final String [] arr = new String[] {"0", "1"}; static final String[] arr = new String[]{"0", "1"};
@Override @Override
public GenericDao<ConsultSheet> getGenericMapper() { public GenericDao<ConsultSheet> getGenericMapper() {
...@@ -61,12 +64,12 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im ...@@ -61,12 +64,12 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im
@Override @Override
public Integer updateDate(String consultId, String status, String description) { public Integer updateDate(String consultId, String status, String description) {
return consultSheetMapper.updateDate(consultId,status,description); return consultSheetMapper.updateDate(consultId, status, description);
} }
@Override @Override
public Integer updateStatus(String consultId, String status) { public Integer updateStatus(String consultId, String status) {
return consultSheetMapper.updateStatus(consultId,status); return consultSheetMapper.updateStatus(consultId, status);
} }
@Override @Override
...@@ -76,7 +79,7 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im ...@@ -76,7 +79,7 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im
params.put("offset", page > 0 ? page : 0); params.put("offset", page > 0 ? page : 0);
params.put("limit", pageSize > 0 ? pageSize : 0); params.put("limit", pageSize > 0 ? pageSize : 0);
params.put("sort", sort); params.put("sort", sort);
if (!StringUtils.equals(id,"1")) { if (!StringUtils.equals(id, "1")) {
params.put("id", id); params.put("id", id);
} }
return consultSheetMapper.fetchSearchByPage(params); return consultSheetMapper.fetchSearchByPage(params);
...@@ -86,6 +89,7 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im ...@@ -86,6 +89,7 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im
public JSONObject pollingConsultSheet(ConsultSheet consultSheet) { public JSONObject pollingConsultSheet(ConsultSheet consultSheet) {
JSONObject retObj = new JSONObject(); JSONObject retObj = new JSONObject();
try { try {
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(consultSheet.getAppId());
consultSheet.setConsultId(codingruleUtils.getNumber(consultSheet.getAccountsId(), ConsultSheet.class.getName())); consultSheet.setConsultId(codingruleUtils.getNumber(consultSheet.getAccountsId(), ConsultSheet.class.getName()));
if (consultSheetMapper.save(consultSheet) > 0) { if (consultSheetMapper.save(consultSheet) > 0) {
memberProcess(consultSheet.getOpenId(), consultSheet); memberProcess(consultSheet.getOpenId(), consultSheet);
...@@ -104,21 +108,22 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im ...@@ -104,21 +108,22 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im
} }
@Override @Override
public JSONObject consultSheetList(String name,Long id) { public JSONObject consultSheetList(String name, Long id, String appId) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
List<ConsultSheet> consultSheets = consultSheetMapper.consultSheetList(name,id); MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
if (consultSheets!=null){ List<ConsultSheet> consultSheets = consultSheetMapper.consultSheetList(name, id);
if (consultSheets != null) {
rtnJson.put("errerNo", 0); rtnJson.put("errerNo", 0);
rtnJson.put("data", consultSheets); rtnJson.put("data", consultSheets);
}else{ } else {
rtnJson.put("errerNo", 1); rtnJson.put("errerNo", 1);
rtnJson.put("errorMsg", "搜索失败"); rtnJson.put("errorMsg", "搜索失败");
} }
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
rtnJson.put("errrNo", 1); rtnJson.put("errrNo", 1);
rtnJson.put("errrMsg", "咨询单列表"+e.getMessage()); rtnJson.put("errrMsg", "咨询单列表" + e.getMessage());
} }
return rtnJson; return rtnJson;
} }
...@@ -126,6 +131,7 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im ...@@ -126,6 +131,7 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im
/** /**
* 咨询单分配流程 * 咨询单分配流程
* 复购/首次分配 * 复购/首次分配
*
* @return * @return
*/ */
private boolean memberProcess(String openid, ConsultSheet consultSheet) { private boolean memberProcess(String openid, ConsultSheet consultSheet) {
...@@ -170,10 +176,12 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im ...@@ -170,10 +176,12 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im
/** /**
* 咨询单首次购买流程 * 咨询单首次购买流程
*
* @return * @return
*/ */
private boolean firstCustomerProcess(ConsultSheet consultSheet) { private boolean firstCustomerProcess(ConsultSheet consultSheet) {
first:for (int i=0, y=arr.length; i<y; i++) { first:
for (int i = 0, y = arr.length; i < y; i++) {
Conds conds = new Conds(); Conds conds = new Conds();
conds.equal("t.del_flag", Constants.DEL_FLAG_0); conds.equal("t.del_flag", Constants.DEL_FLAG_0);
...@@ -188,7 +196,7 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im ...@@ -188,7 +196,7 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im
consultSheet.setDoctorId(users.get(0).getId()); consultSheet.setDoctorId(users.get(0).getId());
} }
if(users.get(0).getPeakVal() > users.get(0).getAssigned()) {//峰值未满 if (users.get(0).getPeakVal() > users.get(0).getAssigned()) {//峰值未满
users.get(0).setAssigned(users.get(0).getAssigned() + 1); users.get(0).setAssigned(users.get(0).getAssigned() + 1);
qyuserService.updateAssigned(users.get(0)); qyuserService.updateAssigned(users.get(0));
} else {//峰值已满 } else {//峰值已满
...@@ -197,7 +205,8 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im ...@@ -197,7 +205,8 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im
} }
} else if (users.size() > 1) { } else if (users.size() > 1) {
//当前分配 //当前分配
second: for (Qyuser user: users) { second:
for (Qyuser user : users) {
if (user.getPeakVal() > user.getAssigned()) {//峰值未满 if (user.getPeakVal() > user.getAssigned()) {//峰值未满
if (arr[i].equals("0")) { if (arr[i].equals("0")) {
...@@ -233,11 +242,11 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im ...@@ -233,11 +242,11 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im
user.setUnAssigned(user.getAssigned() + 1); user.setUnAssigned(user.getAssigned() + 1);
qyuserService.updateAssigned(user); qyuserService.updateAssigned(user);
} else { } else {
consultSheet.setDescription(arr[i].equals("0")? "客服": "药师" +"未有对应的咨询单处理人员"); consultSheet.setDescription(arr[i].equals("0") ? "客服" : "药师" + "未有对应的咨询单处理人员");
} }
} }
} else { } else {
consultSheet.setDescription(arr[i].equals("0")? "客服": "药师"+ "未有对应的咨询单处理人员"); consultSheet.setDescription(arr[i].equals("0") ? "客服" : "药师" + "未有对应的咨询单处理人员");
} }
} }
return true; return true;
......
...@@ -3,6 +3,7 @@ package com.cftech.consultsheet.web; ...@@ -3,6 +3,7 @@ package com.cftech.consultsheet.web;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cftech.consultsheet.model.ConsultSheet; import com.cftech.consultsheet.model.ConsultSheet;
import com.cftech.consultsheet.service.ConsultSheetService; import com.cftech.consultsheet.service.ConsultSheetService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -37,7 +38,7 @@ public class MobileConsultSheetController { ...@@ -37,7 +38,7 @@ public class MobileConsultSheetController {
@RequestMapping(value = "/consultSheetList", @RequestMapping(value = "/consultSheetList",
method = {RequestMethod.GET, RequestMethod.POST}, method = {RequestMethod.GET, RequestMethod.POST},
produces = MediaType.APPLICATION_JSON_UTF8_VALUE) produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject consultSheetList(String name,Long id) { public JSONObject consultSheetList(String name, Long id,String appId) {
return consultSheetService.consultSheetList(name,id); return consultSheetService.consultSheetList(name,id,appId);
} }
} }
...@@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j @Slf4j
@RestController @RestController
@CrossOrigin @CrossOrigin
@RequestMapping("mobile/a/order") @RequestMapping("mobile/auth/order")
public class MobileOrderController { public class MobileOrderController {
@Autowired @Autowired
private OrderService orderService; private OrderService orderService;
......
...@@ -33,7 +33,7 @@ public interface ProductclassifyService extends GenericService<Productclassify> ...@@ -33,7 +33,7 @@ public interface ProductclassifyService extends GenericService<Productclassify>
* @Param * @Param
* @return * @return
**/ **/
JSONObject productList(String productName, String classifyName, String dosagaFrom); JSONObject productList(String productName, String classifyName, String dosagaFrom,String appId);
/** /**
* *
* @Description 商品分类菜单数据回填 * @Description 商品分类菜单数据回填
...@@ -41,7 +41,7 @@ public interface ProductclassifyService extends GenericService<Productclassify> ...@@ -41,7 +41,7 @@ public interface ProductclassifyService extends GenericService<Productclassify>
* @Param * @Param
* @return * @return
**/ **/
JSONObject productMenu(); JSONObject productMenu(String appId);
/** /**
* 根据分类编码查分类ID * 根据分类编码查分类ID
......
...@@ -2,6 +2,8 @@ package com.cftech.productclassify.service.impl; ...@@ -2,6 +2,8 @@ package com.cftech.productclassify.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cftech.accounts.model.MpAccountsEntity;
import com.cftech.accounts.service.MpAccountsService;
import com.cftech.core.sql.Sort; import com.cftech.core.sql.Sort;
import com.cftech.productclassify.model.ProductMenuVO; import com.cftech.productclassify.model.ProductMenuVO;
import com.cftech.productclassify.model.Productclassify; import com.cftech.productclassify.model.Productclassify;
...@@ -32,7 +34,8 @@ public class ProductclassifyServiceImpl extends GenericServiceImpl<Productclassi ...@@ -32,7 +34,8 @@ public class ProductclassifyServiceImpl extends GenericServiceImpl<Productclassi
@Autowired @Autowired
@Qualifier("productclassifyMapper") @Qualifier("productclassifyMapper")
private ProductclassifyMapper productclassifyMapper; private ProductclassifyMapper productclassifyMapper;
@Autowired
private MpAccountsService mpAccountsService;
@Override @Override
public GenericDao<Productclassify> getGenericMapper() { public GenericDao<Productclassify> getGenericMapper() {
return productclassifyMapper; return productclassifyMapper;
...@@ -49,13 +52,15 @@ public class ProductclassifyServiceImpl extends GenericServiceImpl<Productclassi ...@@ -49,13 +52,15 @@ public class ProductclassifyServiceImpl extends GenericServiceImpl<Productclassi
} }
@Override @Override
public JSONObject productList(String productName, String classifyName, String dosagaFrom) { public JSONObject productList(String productName, String classifyName, String dosagaFrom,String appId) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
List<ProductclassifyVO> productVOS = productclassifyMapper.productList(productName, classifyName, dosagaFrom); List<ProductclassifyVO> productVOS = productclassifyMapper.productList(productName, classifyName, dosagaFrom);
if (productVOS==null){ if (productVOS==null){
rtnJson.put("errorNO","1"); rtnJson.put("errorNO","1");
rtnJson.put("errorNo","查询失败"); rtnJson.put("errorNo","查询失败");
return rtnJson;
} }
Log.info("返回结果:"+productVOS); Log.info("返回结果:"+productVOS);
rtnJson.put("errorNO","0"); rtnJson.put("errorNO","0");
...@@ -72,13 +77,15 @@ public class ProductclassifyServiceImpl extends GenericServiceImpl<Productclassi ...@@ -72,13 +77,15 @@ public class ProductclassifyServiceImpl extends GenericServiceImpl<Productclassi
} }
@Override @Override
public JSONObject productMenu() { public JSONObject productMenu(String appId) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
List<ProductMenuVO> menu = productclassifyMapper.productMenu(); List<ProductMenuVO> menu = productclassifyMapper.productMenu();
if (menu==null){ if (menu==null){
rtnJson.put("errorNO","1"); rtnJson.put("errorNO","1");
rtnJson.put("errorMsg","查询失败"); rtnJson.put("errorMsg","查询失败");
return rtnJson;
} }
Log.info("返回结果:"+menu); Log.info("返回结果:"+menu);
rtnJson.put("errorNO","0"); rtnJson.put("errorNO","0");
......
...@@ -30,8 +30,8 @@ public class MobileclassifyController { ...@@ -30,8 +30,8 @@ public class MobileclassifyController {
* @return * @return
**/ **/
@RequestMapping(value = "/productList",method = {RequestMethod.GET,RequestMethod.POST},produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/productList",method = {RequestMethod.GET,RequestMethod.POST},produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject productList(String productName, String classifyName, String dosagaFrom){ public JSONObject productList(String productName, String classifyName, String dosagaFrom,String appId){
return ProductclassifyService.productList(productName,classifyName,dosagaFrom); return ProductclassifyService.productList(productName,classifyName,dosagaFrom,appId);
} }
/** /**
* @Author Licc * @Author Licc
...@@ -41,7 +41,7 @@ public class MobileclassifyController { ...@@ -41,7 +41,7 @@ public class MobileclassifyController {
* @return com.alibaba.fastjson.JSONObject * @return com.alibaba.fastjson.JSONObject
**/ **/
@RequestMapping(value = "/productMenu",method = {RequestMethod.GET,RequestMethod.POST},produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/productMenu",method = {RequestMethod.GET,RequestMethod.POST},produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject productMenu(){ public JSONObject productMenu(String appId){
return ProductclassifyService.productMenu(); return ProductclassifyService.productMenu(appId);
} }
} }
...@@ -31,7 +31,7 @@ public interface ProductService extends GenericService<Product> { ...@@ -31,7 +31,7 @@ public interface ProductService extends GenericService<Product> {
* @Param * @Param
* @return * @return
**/ **/
JSONObject productId(Long ID); JSONObject productId(Long ID,String appId);
/** /**
* 查询产品列表 * 查询产品列表
......
package com.cftech.product.service.impl; package com.cftech.product.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cftech.accounts.model.MpAccountsEntity;
import com.cftech.accounts.service.MpAccountsService;
import com.cftech.base.codingrule.utils.CodingruleUtils; import com.cftech.base.codingrule.utils.CodingruleUtils;
import com.cftech.core.sql.Sort; import com.cftech.core.sql.Sort;
import com.cftech.core.util.StringUtils; import com.cftech.core.util.StringUtils;
...@@ -49,6 +51,8 @@ public class ProductServiceImpl extends GenericServiceImpl<Product> implements P ...@@ -49,6 +51,8 @@ public class ProductServiceImpl extends GenericServiceImpl<Product> implements P
@Autowired @Autowired
private CodingruleUtils codingruleUtils; private CodingruleUtils codingruleUtils;
@Autowired
private MpAccountsService mpAccountsService;
@Override @Override
public GenericDao<Product> getGenericMapper() { public GenericDao<Product> getGenericMapper() {
return productMapper; return productMapper;
...@@ -165,18 +169,21 @@ public class ProductServiceImpl extends GenericServiceImpl<Product> implements P ...@@ -165,18 +169,21 @@ public class ProductServiceImpl extends GenericServiceImpl<Product> implements P
} }
@Override @Override
public JSONObject productId(Long ID) { public JSONObject productId(Long ID,String appId) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
if (ID.equals("")){ if (ID.equals("")){
rtnJson.put("errorNO","1"); rtnJson.put("errorNO","1");
rtnJson.put("errorMsg","id不能为空"); rtnJson.put("errorMsg","id不能为空");
return rtnJson;
} }
List<ProductVO> product = productMapper.product(ID); List<ProductVO> product = productMapper.product(ID);
if (product==null){ if (product==null){
rtnJson.put("errorNO","1"); rtnJson.put("errorNO","1");
rtnJson.put("errorMsg","查询失败"); rtnJson.put("errorMsg","查询失败");
return rtnJson;
} }
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
Log.info("返回结果:"+product); Log.info("返回结果:"+product);
rtnJson.put("errorNO","0"); rtnJson.put("errorNO","0");
rtnJson.put("data",product); rtnJson.put("data",product);
......
...@@ -31,8 +31,8 @@ public class MobileProductController { ...@@ -31,8 +31,8 @@ public class MobileProductController {
* @return * @return
**/ **/
@RequestMapping(value = "/productId",method = {RequestMethod.GET,RequestMethod.POST},produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/productId",method = {RequestMethod.GET,RequestMethod.POST},produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject productMenu(Long ID){ public JSONObject productMenu(Long ID,String appId){
return productService.productId(ID); return productService.productId(ID,appId);
} }
} }
...@@ -52,7 +52,7 @@ public interface CfarticleService extends GenericService<Cfarticle> { ...@@ -52,7 +52,7 @@ public interface CfarticleService extends GenericService<Cfarticle> {
* @Param * @Param
* @return * @return
**/ **/
JSONObject recommended(Long id); JSONObject recommended(Long id,String appId);
/** /**
* @Author Licc * @Author Licc
* @Description 阅读量 * @Description 阅读量
...@@ -60,7 +60,7 @@ public interface CfarticleService extends GenericService<Cfarticle> { ...@@ -60,7 +60,7 @@ public interface CfarticleService extends GenericService<Cfarticle> {
* @Param * @Param
* @return * @return
**/ **/
JSONObject reading(Long id); JSONObject reading(Long id,String appId);
/** /**
* @Author Licc * @Author Licc
* @Description 门户列表数据回填 * @Description 门户列表数据回填
...@@ -68,7 +68,7 @@ public interface CfarticleService extends GenericService<Cfarticle> { ...@@ -68,7 +68,7 @@ public interface CfarticleService extends GenericService<Cfarticle> {
* @Param * @Param
* @return * @return
**/ **/
JSONObject geteway(String title); JSONObject geteway(String title,String appId);
/** /**
* @Author Licc * @Author Licc
* @Description 栏目列表列表数据回填 * @Description 栏目列表列表数据回填
...@@ -76,7 +76,7 @@ public interface CfarticleService extends GenericService<Cfarticle> { ...@@ -76,7 +76,7 @@ public interface CfarticleService extends GenericService<Cfarticle> {
* @Param * @Param
* @return * @return
**/ **/
JSONObject column(); JSONObject column(String appId);
/** /**
* @Author Licc * @Author Licc
* @Description 栏目文章详情 * @Description 栏目文章详情
...@@ -84,5 +84,5 @@ public interface CfarticleService extends GenericService<Cfarticle> { ...@@ -84,5 +84,5 @@ public interface CfarticleService extends GenericService<Cfarticle> {
* @Param * @Param
* @return * @return
**/ **/
JSONObject columnDetails(Long id); JSONObject columnDetails(Long id,String appId);
} }
package com.cftech.cms.cfarticle.service.impl; package com.cftech.cms.cfarticle.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cftech.accounts.model.MpAccountsEntity;
import com.cftech.accounts.service.MpAccountsService;
import com.cftech.cms.cfarticle.dao.CfarticleMapper; import com.cftech.cms.cfarticle.dao.CfarticleMapper;
import com.cftech.cms.cfarticle.model.Cfarticle; import com.cftech.cms.cfarticle.model.Cfarticle;
import com.cftech.cms.cfarticle.model.CfarticleColumnDto; import com.cftech.cms.cfarticle.model.CfarticleColumnDto;
...@@ -33,7 +35,8 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen ...@@ -33,7 +35,8 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen
@Autowired @Autowired
@Qualifier("cfarticleMapper") @Qualifier("cfarticleMapper")
private CfarticleMapper cfarticleMapper; private CfarticleMapper cfarticleMapper;
@Autowired
private MpAccountsService mpAccountsService;
@Override @Override
public GenericDao<Cfarticle> getGenericMapper() { public GenericDao<Cfarticle> getGenericMapper() {
return cfarticleMapper; return cfarticleMapper;
...@@ -95,13 +98,15 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen ...@@ -95,13 +98,15 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen
} }
@Override @Override
public JSONObject recommended(Long id) { public JSONObject recommended(Long id,String appId) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
List<CfarticleVO> recommended = cfarticleMapper.recommended(id); List<CfarticleVO> recommended = cfarticleMapper.recommended(id);
if (recommended.size()>0) { if (recommended.size()>0) {
rtnJson.put("errorNo", "0"); rtnJson.put("errorNo", "0");
rtnJson.put("data", recommended); rtnJson.put("data", recommended);
return rtnJson;
} }
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "查询失败"); rtnJson.put("errorMsg", "查询失败");
...@@ -115,10 +120,11 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen ...@@ -115,10 +120,11 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public JSONObject reading(Long id) { public JSONObject reading(Long id,String appId) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
int count = 1; int count = 1;
try { try {
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
CfarticleVO reading = cfarticleMapper.saveReading(id); CfarticleVO reading = cfarticleMapper.saveReading(id);
Long recommended = reading.getRecommended(); Long recommended = reading.getRecommended();
Long redings = reading.getReading(); Long redings = reading.getReading();
...@@ -142,14 +148,15 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen ...@@ -142,14 +148,15 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen
} }
@Override @Override
public JSONObject geteway(String title) { public JSONObject geteway(String title,String appId) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
List<Cfarticle> cfarticles = cfarticleMapper.gateway(title); List<Cfarticle> cfarticles = cfarticleMapper.gateway(title);
if (cfarticles==null){ if (cfarticles==null){
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg","查询失败"); rtnJson.put("errorMsg","查询失败");
return rtnJson;
} }
rtnJson.put("errorNo", "0"); rtnJson.put("errorNo", "0");
rtnJson.put("errorMsg",cfarticles); rtnJson.put("errorMsg",cfarticles);
...@@ -163,14 +170,15 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen ...@@ -163,14 +170,15 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen
} }
@Override @Override
public JSONObject column() { public JSONObject column(String appId) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
List<columnVO> column = cfarticleMapper.column(); List<columnVO> column = cfarticleMapper.column();
if (column==null){ if (column==null){
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg","查询失败"); rtnJson.put("errorMsg","查询失败");
return rtnJson;
} }
rtnJson.put("errorNo", "0"); rtnJson.put("errorNo", "0");
rtnJson.put("errorMsg",column); rtnJson.put("errorMsg",column);
...@@ -184,13 +192,15 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen ...@@ -184,13 +192,15 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen
} }
@Override @Override
public JSONObject columnDetails(Long id) { public JSONObject columnDetails(Long id,String appId) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
List<CfarticleVO> cfarticleVOS = cfarticleMapper.columnDetails(id); List<CfarticleVO> cfarticleVOS = cfarticleMapper.columnDetails(id);
if (cfarticleVOS==null){ if (cfarticleVOS==null){
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg","查询失败"); rtnJson.put("errorMsg","查询失败");
return rtnJson;
} }
rtnJson.put("errorNo", "0"); rtnJson.put("errorNo", "0");
rtnJson.put("errorMsg",cfarticleVOS); rtnJson.put("errorMsg",cfarticleVOS);
......
...@@ -131,8 +131,8 @@ public class MobileCfArticleController { ...@@ -131,8 +131,8 @@ public class MobileCfArticleController {
* @Param * @Param
**/ **/
@RequestMapping(value = "/recommended", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/recommended", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public com.alibaba.fastjson.JSONObject recommended(Long id) { public com.alibaba.fastjson.JSONObject recommended(Long id,String appId) {
return cfarticleService.recommended(id); return cfarticleService.recommended(id,appId);
} }
/** /**
* @return * @return
...@@ -142,8 +142,8 @@ public class MobileCfArticleController { ...@@ -142,8 +142,8 @@ public class MobileCfArticleController {
* @Param * @Param
**/ **/
@RequestMapping(value = "/reading", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/reading", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public com.alibaba.fastjson.JSONObject reading(Long id) { public com.alibaba.fastjson.JSONObject reading(Long id,String appId) {
return cfarticleService.reading(id); return cfarticleService.reading(id,appId);
} }
/** /**
* @Author Licc * @Author Licc
...@@ -153,8 +153,8 @@ public class MobileCfArticleController { ...@@ -153,8 +153,8 @@ public class MobileCfArticleController {
* @return * @return
**/ **/
@RequestMapping(value = "/gateway", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/gateway", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public com.alibaba.fastjson.JSONObject gateway(String title){ public com.alibaba.fastjson.JSONObject gateway(String title,String appId){
return cfarticleService.geteway(title); return cfarticleService.geteway(title,appId);
} }
/** /**
* @Author Licc * @Author Licc
...@@ -164,8 +164,8 @@ public class MobileCfArticleController { ...@@ -164,8 +164,8 @@ public class MobileCfArticleController {
* @return * @return
**/ **/
@RequestMapping(value = "/column", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/column", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public com.alibaba.fastjson.JSONObject column(){ public com.alibaba.fastjson.JSONObject column(String appId){
return cfarticleService.column(); return cfarticleService.column(appId);
} }
/** /**
* @Author Licc * @Author Licc
...@@ -175,7 +175,7 @@ public class MobileCfArticleController { ...@@ -175,7 +175,7 @@ public class MobileCfArticleController {
* @return * @return
**/ **/
@RequestMapping(value = "/columnDetails", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/columnDetails", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public com.alibaba.fastjson.JSONObject columnDetails(Long id){ public com.alibaba.fastjson.JSONObject columnDetails(Long id,String appId){
return cfarticleService.columnDetails(id); return cfarticleService.columnDetails(id,appId);
} }
} }
...@@ -13,7 +13,8 @@ import java.util.Date; ...@@ -13,7 +13,8 @@ import java.util.Date;
*/ */
@Data @Data
public class MemberVO { public class MemberVO {
/*appid*/
private String appId;
private Long id; private Long id;
/*姓名*/ /*姓名*/
private String memberName; private String memberName;
......
...@@ -52,7 +52,7 @@ public interface MemberService extends GenericService<Member> { ...@@ -52,7 +52,7 @@ public interface MemberService extends GenericService<Member> {
* @Param * @Param
* @return * @return
**/ **/
JSONObject memberFormation(Long id); JSONObject memberFormation(Long id,String appId);
/** /**
* 个人信息修改 * 个人信息修改
......
...@@ -2,6 +2,8 @@ package com.cftech.member.service.impl; ...@@ -2,6 +2,8 @@ package com.cftech.member.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cftech.accounts.model.MpAccountsEntity;
import com.cftech.accounts.service.MpAccountsService;
import com.cftech.core.generic.GenericDao; import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl; import com.cftech.core.generic.GenericServiceImpl;
import com.cftech.core.scope.OrderType; import com.cftech.core.scope.OrderType;
...@@ -39,7 +41,8 @@ public class MemberServiceImpl extends GenericServiceImpl<Member> implements Mem ...@@ -39,7 +41,8 @@ public class MemberServiceImpl extends GenericServiceImpl<Member> implements Mem
@Autowired @Autowired
@Qualifier("memberMapper") @Qualifier("memberMapper")
private MemberMapper memberMapper; private MemberMapper memberMapper;
@Autowired
private MpAccountsService mpAccountsService;
@Autowired @Autowired
private WorkshopService workshopService; private WorkshopService workshopService;
...@@ -85,7 +88,7 @@ public class MemberServiceImpl extends GenericServiceImpl<Member> implements Mem ...@@ -85,7 +88,7 @@ public class MemberServiceImpl extends GenericServiceImpl<Member> implements Mem
} }
@Override @Override
public JSONObject memberFormation(Long id) { public JSONObject memberFormation(Long id, String appId) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
if (org.springframework.util.StringUtils.isEmpty(id)) { if (org.springframework.util.StringUtils.isEmpty(id)) {
...@@ -93,6 +96,7 @@ public class MemberServiceImpl extends GenericServiceImpl<Member> implements Mem ...@@ -93,6 +96,7 @@ public class MemberServiceImpl extends GenericServiceImpl<Member> implements Mem
rtnJson.put("errorMsg", "id不能为空"); rtnJson.put("errorMsg", "id不能为空");
return rtnJson; return rtnJson;
} }
MpAccountsEntity accountsAppid = mpAccountsService.getMpAccountsAppid(appId);
List<MemberVO> memberVOS = memberMapper.memberFormation(id); List<MemberVO> memberVOS = memberMapper.memberFormation(id);
Log.info("返回值" + memberVOS); Log.info("返回值" + memberVOS);
rtnJson.put("errorNo", "0"); rtnJson.put("errorNo", "0");
...@@ -126,6 +130,7 @@ public class MemberServiceImpl extends GenericServiceImpl<Member> implements Mem ...@@ -126,6 +130,7 @@ public class MemberServiceImpl extends GenericServiceImpl<Member> implements Mem
rtnJson.put("errorMsg", "联系方式不能为空"); rtnJson.put("errorMsg", "联系方式不能为空");
return rtnJson; return rtnJson;
} }
MpAccountsEntity accountsAppid = mpAccountsService.getMpAccountsAppid(memberVO.getAppId());
int i = memberMapper.updateMember(memberVO); int i = memberMapper.updateMember(memberVO);
if (i > 0) { if (i > 0) {
rtnJson.put("errorNo", "0"); rtnJson.put("errorNo", "0");
......
...@@ -31,8 +31,8 @@ public class MobileMemberController { ...@@ -31,8 +31,8 @@ public class MobileMemberController {
* @Param * @Param
**/ **/
@RequestMapping(value = "/memberFormation", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/memberFormation", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject memberFormation(Long id) { public JSONObject memberFormation(Long id,String appId) {
return memberService.memberFormation(id); return memberService.memberFormation(id,appId);
} }
/** /**
......
...@@ -61,6 +61,8 @@ public class Address extends Area implements Serializable { ...@@ -61,6 +61,8 @@ public class Address extends Area implements Serializable {
/* 更新人 */ /* 更新人 */
private Long updateBy; private Long updateBy;
private String appId;
public Address() { public Address() {
this.delFlag = false; this.delFlag = false;
this.status = "0"; this.status = "0";
......
...@@ -23,14 +23,14 @@ public interface AddressService extends GenericService<Address> { ...@@ -23,14 +23,14 @@ public interface AddressService extends GenericService<Address> {
* @Param * @Param
* @return * @return
**/ **/
JSONObject addressList(String openId); JSONObject addressList(String openId,String appId);
/** /**
* @Description 根据id查询收货地址 * @Description 根据id查询收货地址
* @Date 9:53 2020/10/20 * @Date 9:53 2020/10/20
* @Param * @Param
* @return * @return
**/ **/
JSONObject addressId(Long id); JSONObject addressId(Long id,String appId);
/** /**
* @Description 个人收货地址新增 * @Description 个人收货地址新增
* @Date 9:53 2020/10/20 * @Date 9:53 2020/10/20
...@@ -54,5 +54,6 @@ public interface AddressService extends GenericService<Address> { ...@@ -54,5 +54,6 @@ public interface AddressService extends GenericService<Address> {
* @Param * @Param
* @return * @return
**/ **/
JSONObject deleteAddress(String id); JSONObject deleteAddress(String id,String appId);
} }
...@@ -2,6 +2,8 @@ package com.cftech.addresst.service.impl; ...@@ -2,6 +2,8 @@ package com.cftech.addresst.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.aspose.words.IFieldMergingCallback; import com.aspose.words.IFieldMergingCallback;
import com.cftech.accounts.model.MpAccountsEntity;
import com.cftech.accounts.service.MpAccountsService;
import com.cftech.addresst.model.Address; import com.cftech.addresst.model.Address;
import com.cftech.addresst.dao.AddressMapper; import com.cftech.addresst.dao.AddressMapper;
import com.cftech.addresst.model.AddressVO; import com.cftech.addresst.model.AddressVO;
...@@ -10,9 +12,9 @@ import com.cftech.addresst.service.AddressService; ...@@ -10,9 +12,9 @@ import com.cftech.addresst.service.AddressService;
import com.cftech.core.generic.GenericDao; import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl; import com.cftech.core.generic.GenericServiceImpl;
import com.cftech.core.sql.Conds; import com.cftech.core.sql.Conds;
import com.cftech.core.util.StringUtils;
import com.cftech.sys.security.UserUtils; import com.cftech.sys.security.UserUtils;
import com.esotericsoftware.minlog.Log; import com.esotericsoftware.minlog.Log;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.record.chart.AxisUsedRecord; import org.apache.poi.hssf.record.chart.AxisUsedRecord;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
...@@ -25,18 +27,19 @@ import java.util.HashMap; ...@@ -25,18 +27,19 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
/** /**
* 收货地址管理ServiceImpl * 收货地址管理ServiceImpl
* *
* @author Licc * @author Licc
* @date: 2020-09-29 17:17 * @date: 2020-09-29 17:17
*/ */
@Service("addressService") @Service("addressService")
public class AddressServiceImpl extends GenericServiceImpl<Address> implements AddressService { public class AddressServiceImpl extends GenericServiceImpl<Address> implements AddressService {
@Autowired @Autowired
@Qualifier("addressMapper") @Qualifier("addressMapper")
private AddressMapper addressMapper; private AddressMapper addressMapper;
@Autowired
private MpAccountsService mpAccountsService;
@Override @Override
public GenericDao<Address> getGenericMapper() { public GenericDao<Address> getGenericMapper() {
return addressMapper; return addressMapper;
...@@ -48,7 +51,7 @@ public class AddressServiceImpl extends GenericServiceImpl<Address> implements A ...@@ -48,7 +51,7 @@ public class AddressServiceImpl extends GenericServiceImpl<Address> implements A
} }
@Override @Override
public JSONObject addressList(String openId) { public JSONObject addressList(String openId,String appId) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
...@@ -57,6 +60,7 @@ public class AddressServiceImpl extends GenericServiceImpl<Address> implements A ...@@ -57,6 +60,7 @@ public class AddressServiceImpl extends GenericServiceImpl<Address> implements A
rtnJson.put("errorMsg", "openId不能为空"); rtnJson.put("errorMsg", "openId不能为空");
return rtnJson; return rtnJson;
} }
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
List<AddressVO> addressList = addressMapper.addressList(openId); List<AddressVO> addressList = addressMapper.addressList(openId);
Log.info("参数:" + addressList); Log.info("参数:" + addressList);
if (!addressList.equals("") || addressList != null) { if (!addressList.equals("") || addressList != null) {
...@@ -72,7 +76,7 @@ public class AddressServiceImpl extends GenericServiceImpl<Address> implements A ...@@ -72,7 +76,7 @@ public class AddressServiceImpl extends GenericServiceImpl<Address> implements A
} }
@Override @Override
public JSONObject addressId(Long id) { public JSONObject addressId(Long id,String appId) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
if (id.equals("")) { if (id.equals("")) {
...@@ -80,15 +84,16 @@ public class AddressServiceImpl extends GenericServiceImpl<Address> implements A ...@@ -80,15 +84,16 @@ public class AddressServiceImpl extends GenericServiceImpl<Address> implements A
rtnJson.put("errorMsg", "id不能为空"); rtnJson.put("errorMsg", "id不能为空");
return rtnJson; return rtnJson;
} }
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
List<AddressVO> addressVOS = addressMapper.addressId(id); List<AddressVO> addressVOS = addressMapper.addressId(id);
if (addressVOS != null) { if (addressVOS!=null){
Log.info("参数:" + addressVOS); Log.info("参数:"+addressVOS);
rtnJson.put("errorNo", "0"); rtnJson.put("errorNo","0");
rtnJson.put("errorMsg", addressVOS); rtnJson.put("errorMsg",addressVOS);
} }
} catch (Exception e) { }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
rtnJson.put("errorNO", "1"); rtnJson.put("errorNO","1");
} }
return rtnJson; return rtnJson;
} }
...@@ -100,26 +105,27 @@ public class AddressServiceImpl extends GenericServiceImpl<Address> implements A ...@@ -100,26 +105,27 @@ public class AddressServiceImpl extends GenericServiceImpl<Address> implements A
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
if (address.getOpenId().equals("")) { if (StringUtils.isEmpty(address.getOpenId())) {
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "openid不能为空"); rtnJson.put("errorMsg", "openid不能为空");
return rtnJson; return rtnJson;
} }
if (address.getAddressName().equals("")) { if (StringUtils.isEmpty(address.getAddressName())) {
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "收货人姓名不能为空"); rtnJson.put("errorMsg", "收货人姓名不能为空");
return rtnJson; return rtnJson;
} }
if (address.getPhone().equals("")) { if (StringUtils.isEmpty(address.getPhone())) {
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "手机号码不能为空"); rtnJson.put("errorMsg", "手机号码不能为空");
return rtnJson; return rtnJson;
} }
if (address.getAddress().equals("")) { if (StringUtils.isEmpty(address.getAddress())) {
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "详细地址不能为空"); rtnJson.put("errorMsg", "详细地址不能为空");
return rtnJson; return rtnJson;
} }
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(address.getAppId());
address.setOpenId(address.getOpenId()); address.setOpenId(address.getOpenId());
address.setAccountsId(address.getAccountsId()); address.setAccountsId(address.getAccountsId());
address.setDelFlag(false); address.setDelFlag(false);
...@@ -135,7 +141,7 @@ public class AddressServiceImpl extends GenericServiceImpl<Address> implements A ...@@ -135,7 +141,7 @@ public class AddressServiceImpl extends GenericServiceImpl<Address> implements A
Long whether = address.getWhether(); Long whether = address.getWhether();
String openId = address.getOpenId(); String openId = address.getOpenId();
Integer list = addressMapper.whetherList(openId); Integer list = addressMapper.whetherList(openId);
if (list != null) { if ( list!=null) {
HashMap<String, Object> param = new HashMap<>(); HashMap<String, Object> param = new HashMap<>();
param.put("whether", whether); param.put("whether", whether);
param.put("openId", openId); param.put("openId", openId);
...@@ -143,47 +149,46 @@ public class AddressServiceImpl extends GenericServiceImpl<Address> implements A ...@@ -143,47 +149,46 @@ public class AddressServiceImpl extends GenericServiceImpl<Address> implements A
if (i == 0) { if (i == 0) {
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "新增失败"); rtnJson.put("errorMsg", "新增失败");
return rtnJson;
} }
} }
addressMapper.save(address); addressMapper.save(address);
rtnJson.put("errorNo", "0"); rtnJson.put("errorNo","0");
rtnJson.put("errorMsg", "新增成功"); rtnJson.put("errorMsg","新增成功");
} }
} catch (Exception e) { }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo","1");
} }
return rtnJson; return rtnJson;
} }
@Transactional @Transactional
@Override @Override
public JSONObject updateAddress(Address address) { public JSONObject updateAddress(Address address) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
if (address.getOpenId().equals("")) { if (StringUtils.isEmpty(address.getOpenId())) {
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "openid不能为空"); rtnJson.put("errorMsg", "openid不能为空");
return rtnJson; return rtnJson;
} }
if (address.getAddressName().equals("")) { if (StringUtils.isEmpty(address.getAddressName())) {
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "收货人姓名不能为空"); rtnJson.put("errorMsg", "收货人姓名不能为空");
return rtnJson; return rtnJson;
} }
if (address.getPhone().equals("")) { if (StringUtils.isEmpty(address.getPhone())) {
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "手机号码不能为空"); rtnJson.put("errorMsg", "手机号码不能为空");
return rtnJson; return rtnJson;
} }
if (address.getAddress().equals("")) { if (StringUtils.isEmpty(address.getAddress())) {
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "详细地址不能为空"); rtnJson.put("errorMsg", "详细地址不能为空");
return rtnJson; return rtnJson;
} }
Log.info("参数:" + address); Log.info("参数:" + address);
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(address.getAppId());
address.setId(address.getId()); address.setId(address.getId());
address.setAddressName(address.getAddressName()); address.setAddressName(address.getAddressName());
address.setPhone(address.getPhone()); address.setPhone(address.getPhone());
...@@ -224,7 +229,7 @@ public class AddressServiceImpl extends GenericServiceImpl<Address> implements A ...@@ -224,7 +229,7 @@ public class AddressServiceImpl extends GenericServiceImpl<Address> implements A
} }
@Override @Override
public JSONObject deleteAddress(String id) { public JSONObject deleteAddress(String id,String appId) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
if (StringUtils.isBlank(id)) { if (StringUtils.isBlank(id)) {
...@@ -232,6 +237,7 @@ public class AddressServiceImpl extends GenericServiceImpl<Address> implements A ...@@ -232,6 +237,7 @@ public class AddressServiceImpl extends GenericServiceImpl<Address> implements A
rtnJson.put("errorMsg", "id不能为空"); rtnJson.put("errorMsg", "id不能为空");
return rtnJson; return rtnJson;
} }
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
int delete = addressMapper.delete(id); int delete = addressMapper.delete(id);
if (delete > 0) { if (delete > 0) {
rtnJson.put("errorNo", "0"); rtnJson.put("errorNo", "0");
......
...@@ -37,8 +37,8 @@ public class MobileAddressController { ...@@ -37,8 +37,8 @@ public class MobileAddressController {
* @Param * @Param
**/ **/
@RequestMapping(value = "/addressList", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/addressList", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject addressList(String openId) { public JSONObject addressList(String openId,String appId) {
return addressService.addressList(openId); return addressService.addressList(openId,appId);
} }
/** /**
...@@ -48,8 +48,8 @@ public class MobileAddressController { ...@@ -48,8 +48,8 @@ public class MobileAddressController {
* @Param * @Param
**/ **/
@RequestMapping(value = "/addressId", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/addressId", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject addressId(Long id) { public JSONObject addressId(Long id,String appId) {
return addressService.addressId(id); return addressService.addressId(id,appId);
} }
/** /**
...@@ -59,7 +59,7 @@ public class MobileAddressController { ...@@ -59,7 +59,7 @@ public class MobileAddressController {
* @Param * @Param
**/ **/
@RequestMapping(value = "/listArea", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/listArea", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject listArea() { public JSONObject listArea(String appId) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
...@@ -106,7 +106,9 @@ public class MobileAddressController { ...@@ -106,7 +106,9 @@ public class MobileAddressController {
* @Param * @Param
**/ **/
@RequestMapping(value = "/deleteAddress", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/deleteAddress", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject deleteAddress(String id) { public JSONObject deleteAddress(String id,String appId) {
return addressService.deleteAddress(id); return addressService.deleteAddress(id,appId);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment