Commit 6b9704b1 authored by 黎聪聪's avatar 黎聪聪

2020年10月28日 10:15:51

parent 27b7e18b
......@@ -5,6 +5,7 @@ import com.cftech.productclassify.service.ProductclassifyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
......@@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@Slf4j
@RestController
@CrossOrigin
@RequestMapping("mobile/auth/productclassify")
public class MobileclassifyController {
@Autowired
......
......@@ -110,7 +110,8 @@
t.is_rs AS isRs,
t.product_number AS productNumber,
t.accounts_id AS accountsId,
c.classify_name AS classifyName
c.classify_name AS classifyName,
t.product_img_detail AS productImgDetail
</sql>
<insert id="save" parameterType="com.cftech.product.model.Product" useGeneratedKeys="true"
......
......@@ -48,12 +48,14 @@ public class ProductVO {
private String isRs;
/*产品编码*/
private String productNumber;
/*销量*/
private Long sales;
/*accounts_id*/
private Long accountsId;
/*分类名称*/
private String classifyName;
/*产品详情图*/
private String productImgDetail;
}
......@@ -5,6 +5,7 @@ import com.cftech.product.service.ProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
......@@ -17,6 +18,7 @@ import sun.util.resources.cldr.gv.LocaleNames_gv;
*/
@Slf4j
@RestController
@CrossOrigin
@RequestMapping("mobile/auth/product")
public class MobileProductController {
@Autowired
......
......@@ -381,8 +381,8 @@
<!--个人信息回填
-->
<select id="memberFormation" parameterType="java.lang.Long" resultType="com.cftech.member.model.MemberVO">
SELECT CONVERT(AES_DECRYPT(name,'aideakey') USING UTF8) AS memberName,sex,CONVERT(AES_DECRYPT(birthday,'aideakey')USING UTF8) birthday,imageurl,CONVERT(AES_DECRYPT(email,'aideakey')USING UTF8) AS mailbox,CONVERT(AES_DECRYPT(phone,'aideakey')USING UTF8) as phone
FROM wx_mp_member WHERE id= #{Id} and del_flag=0
SELECT id,CONVERT(AES_DECRYPT(name,'aideakey') USING UTF8) AS memberName,sex,CONVERT(AES_DECRYPT(birthday,'aideakey')USING UTF8) birthday,imageurl,CONVERT(AES_DECRYPT(email,'aideakey')USING UTF8) AS mailbox,CONVERT(AES_DECRYPT(phone,'aideakey')USING UTF8) as phone
FROM wx_mp_member WHERE id= #{id} and del_flag=0
</select>
<!--个人信息修改
-->
......@@ -393,13 +393,13 @@
`name` = AES_ENCRYPT(#{memberName},'aideakey'),
</if>
<if test="sex !=null">
sex = sex,
sex = #{sex},
</if>
<if test="birthday !=null">
birthday = AES_ENCRYPT(#{birthday},'aideakey'),
</if>
<if test="mailbox !=null">
other = AES_ENCRYPT(#{mailbox},'aideakey'),
email = AES_ENCRYPT(#{mailbox},'aideakey'),
</if>
<if test="phone !=null">
phone = AES_ENCRYPT(#{phone},'aideakey'),
......@@ -408,6 +408,6 @@
imageurl = #{imageUrl}
</if>
</set>
where id =#{Id}
where id =#{id}
</update>
</mapper>
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.cftech.member.model;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
......@@ -12,13 +13,13 @@ import java.util.Date;
*/
@Data
public class MemberVO {
private Long Id;
private Long id;
/*姓名*/
private String memberName;
/*性别*/
private Long Sex;
private Long sex;
/*生日*/
@JSONField(format = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date birthday;
/* 邮箱*/
private String mailbox;
......
package com.cftech.member.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl;
......@@ -22,9 +23,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* ServiceImpl
......@@ -88,13 +88,13 @@ public class MemberServiceImpl extends GenericServiceImpl<Member> implements Mem
if (org.springframework.util.StringUtils.isEmpty(id)){
rtnJson.put("errorNo","1");
rtnJson.put("errorMsg","id不能为空");
return rtnJson;
}
List<MemberVO> memberVOS = memberMapper.memberFormation(id);
Log.info("参数值"+memberVOS);
Log.info("返回值"+memberVOS);
rtnJson.put("errorNo","0");
rtnJson.put("data",memberVOS);
return rtnJson;
}catch (Exception e){
e.printStackTrace();
rtnJson.put("errorNo","1");
......@@ -106,6 +106,10 @@ public class MemberServiceImpl extends GenericServiceImpl<Member> implements Mem
public JSONObject updateMember(MemberVO memberVO) {
JSONObject rtnJson = new JSONObject();
try {
SimpleDateFormat sdf1= new SimpleDateFormat( "yy-MM-dd" , Locale. CHINA );
String format = sdf1.format(memberVO.getBirthday());
Date date = sdf1.parse(format);
memberVO.setBirthday(date);
if (StringUtils.isEmpty(memberVO.getMemberName())){
rtnJson.put("errorNo","1");
rtnJson.put("errorMsg","姓名不能为空");
......@@ -132,6 +136,8 @@ public class MemberServiceImpl extends GenericServiceImpl<Member> implements Mem
}
}catch (Exception e){
e.printStackTrace();
rtnJson.put("errorNo","1");
rtnJson.put("errorMsg","系统异常");
}
return rtnJson;
}
......
......@@ -7,9 +7,7 @@ import com.sun.xml.bind.v2.model.core.ID;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* @author :licc
......@@ -18,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@Slf4j
@RestController
@CrossOrigin
@RequestMapping("mobile/auth/member")
public class MobileMemberController {
@Autowired
......@@ -29,13 +28,20 @@ public class MobileMemberController {
* @Param
* @return
**/
@RequestMapping(value = "/memberFormation",method = {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){
return memberService.memberFormation(id);
}
@RequestMapping(value = "/updateMember",method = {RequestMethod.GET,RequestMethod.POST},produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject updateMember(MemberVO memberVO){
/**
* @Author Licc
* @Description 个人信息修改
* @Date 14:27 2020/10/19
* @Param
* @return
**/
@RequestMapping(value = "/updateMember",method = {RequestMethod.POST},produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject updateMember(@RequestBody MemberVO memberVO){
return memberService.updateMember(memberVO);
}
}
package com.cftech.addresst.dao;
import com.alibaba.fastjson.JSONObject;
import com.cftech.addresst.model.Address;
import com.cftech.addresst.model.AddressVO;
import com.cftech.addresst.model.Area;
......@@ -30,6 +31,14 @@ public interface AddressMapper extends GenericDao<Address> {
* @return
**/
List<AddressVO> addressList(String openId);
/**
* @Description 根据id查询收货地址
* @Date 9:53 2020/10/20
* @Param
* @return
**/
List<AddressVO> addressId(Long id);
/**
*
* @Description 默认地址修改
......
......@@ -126,6 +126,33 @@
#{updateBy, jdbcType=BIGINT}
)
</insert>
<select id="addressId" resultType="com.cftech.addresst.model.AddressVO">
select
t.id,
t.open_id as openId,
t.address_name as addressName,
t.address,
t.province_id as provinceId,
t.city_id as cityId,
t.area_id as areaId,
t.sex,
t.phone,
t.whether,
t.accounts_id as accountsId,
a.areaid,
a.citytype,
a.areaname provinceName,
b.areaname cityName,
c.areaname areaName
FROM
t_shipping_address t
LEFT JOIN area a ON t.province_id = a.areaid
LEFT JOIN area b ON t.city_id = b.areaid
LEFT JOIN area c ON t.area_id = c.areaid
and t.del_flag=0
WHERE t.id = #{id}
</select>
<select id="addressList" resultType="com.cftech.addresst.model.AddressVO">
SELECT
t.id,
......
......@@ -24,6 +24,13 @@ public interface AddressService extends GenericService<Address> {
* @return
**/
JSONObject addressList(String openId);
/**
* @Description 根据id查询收货地址
* @Date 9:53 2020/10/20
* @Param
* @return
**/
JSONObject addressId(Long id);
/**
* @Description 个人收货地址新增
* @Date 9:53 2020/10/20
......
......@@ -70,6 +70,27 @@ return addressMapper;
return rtnJson;
}
@Override
public JSONObject addressId(Long id) {
JSONObject rtnJson = new JSONObject();
try {
if (id.equals("")){
rtnJson.put("errorNo","1");
rtnJson.put("errorMsg","id不能为空");
}
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");
}
return rtnJson;
}
@Transactional
@Override
......@@ -78,19 +99,19 @@ return addressMapper;
try {
if (address.getOpenId().equals("")){
rtnJson.put("errorNO","1");
rtnJson.put("errorNo","1");
rtnJson.put("errorMsg","openid不能为空");
}
if (address.getAddressName().equals("")){
rtnJson.put("errorNO","1");
rtnJson.put("errorNo","1");
rtnJson.put("errorMsg","收货人姓名不能为空");
}
if (address.getPhone().equals("")){
rtnJson.put("errorNO","1");
rtnJson.put("errorNo","1");
rtnJson.put("errorMsg","手机号码不能为空");
}
if (address.getAddress().equals("")){
rtnJson.put("errorNO","1");
rtnJson.put("errorNo","1");
rtnJson.put("errorMsg","详细地址不能为空");
}
address.setOpenId(address.getOpenId());
......@@ -114,18 +135,18 @@ return addressMapper;
param.put("openId", openId);
int i = addressMapper.updateWhether(param);
if (i == 0) {
rtnJson.put("errorNO", "1");
rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "新增失败");
}
}
addressMapper.save(address);
rtnJson.put("errorNO","0");
rtnJson.put("errorNo","0");
rtnJson.put("errorMsg","新增成功");
}
}catch (Exception e){
e.printStackTrace();
rtnJson.put("errorNO","1");
rtnJson.put("errorNo","1");
}
return rtnJson;
}
......@@ -135,19 +156,19 @@ return addressMapper;
JSONObject rtnJson = new JSONObject();
try {
if (address.getOpenId().equals("")){
rtnJson.put("errorNO","1");
rtnJson.put("errorNo","1");
rtnJson.put("errorMsg","openid不能为空");
}
if (address.getAddressName().equals("")){
rtnJson.put("errorNO","1");
rtnJson.put("errorNo","1");
rtnJson.put("errorMsg","收货人姓名不能为空");
}
if (address.getPhone().equals("")){
rtnJson.put("errorNO","1");
rtnJson.put("errorNo","1");
rtnJson.put("errorMsg","手机号码不能为空");
}
if (address.getAddress().equals("")){
rtnJson.put("errorNO","1");
rtnJson.put("errorNo","1");
rtnJson.put("errorMsg","详细地址不能为空");
}
Log.info("参数:"+address);
......@@ -169,17 +190,17 @@ return addressMapper;
param.put("openId", openId);
int i = addressMapper.updateWhether(param);
if (i == 0) {
rtnJson.put("errorNO", "1");
rtnJson.put("errorNo","1");
rtnJson.put("errorMsg", "修改失败");
}
}
}
int i = addressMapper.update(address);
if (i>0) {
rtnJson.put("errorNO","0");
rtnJson.put("errorNo","0");
rtnJson.put("errorMsg","修改成功");
}else {
rtnJson.put("errorNO","1");
rtnJson.put("errorNo","1");
rtnJson.put("errorMsg","修改失败");
}
......@@ -195,17 +216,17 @@ return addressMapper;
JSONObject rtnJson = new JSONObject();
try {
if (id.equals("")){
rtnJson.put("errorNO","1");
rtnJson.put("errorNo","1");
rtnJson.put("errorMsg","id不能为空");
}
int delete = addressMapper.delete(id);
if (delete>0){
rtnJson.put("errorNO","0");
rtnJson.put("errorNo","0");
rtnJson.put("errorMsg","删除成功");
}
}catch (Exception e){
e.printStackTrace();
rtnJson.put("errorNO","1");
rtnJson.put("errorNo","0");
}
return rtnJson;
}
......
......@@ -7,6 +7,7 @@ import com.cftech.addresst.service.AddressService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
......@@ -22,6 +23,7 @@ import java.util.List;
*/
@Slf4j
@RestController
@CrossOrigin
@RequestMapping("mobile/auth/address")
public class MobileAddressController {
@Autowired
......@@ -38,6 +40,16 @@ public class MobileAddressController {
public JSONObject addressList(String openId){
return addressService.addressList(openId);
}
/**
* @Description 根据id查询收货地址
* @Date 9:53 2020/10/20
* @Param
* @return
**/
@RequestMapping(value = "/addressId",method = {RequestMethod.GET,RequestMethod.POST},produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject addressId(Long id){
return addressService.addressId(id);
}
/**
* @Description 省市区信息回填
* @Date 9:53 2020/10/20
......
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