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