diff --git a/ant-design-vue-jeecg/src/views/shopping/assets/common.css b/ant-design-vue-jeecg/src/views/shopping/assets/common.css index 049bc78c..f4463678 100644 --- a/ant-design-vue-jeecg/src/views/shopping/assets/common.css +++ b/ant-design-vue-jeecg/src/views/shopping/assets/common.css @@ -71,7 +71,9 @@ a { .fw_600 { font-weight: 600; } - +.fw_500 { + font-weight: 500; +} .c_333 { color: #333; } diff --git a/ant-design-vue-jeecg/src/views/shopping/assets/erweima.png b/ant-design-vue-jeecg/src/views/shopping/assets/erweima.png new file mode 100644 index 00000000..f22381bd Binary files /dev/null and b/ant-design-vue-jeecg/src/views/shopping/assets/erweima.png differ diff --git a/ant-design-vue-jeecg/src/views/shopping/components/addrView.vue b/ant-design-vue-jeecg/src/views/shopping/components/addrView.vue new file mode 100644 index 00000000..dab71ccc --- /dev/null +++ b/ant-design-vue-jeecg/src/views/shopping/components/addrView.vue @@ -0,0 +1,445 @@ + + + + + diff --git a/ant-design-vue-jeecg/src/views/shopping/components/collection.vue b/ant-design-vue-jeecg/src/views/shopping/components/collection.vue new file mode 100644 index 00000000..62ab5511 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/shopping/components/collection.vue @@ -0,0 +1,320 @@ + + + + + diff --git a/ant-design-vue-jeecg/src/views/shopping/pages/gerenzhongxin.vue b/ant-design-vue-jeecg/src/views/shopping/pages/gerenzhongxin.vue index 33863bc7..12c413cc 100644 --- a/ant-design-vue-jeecg/src/views/shopping/pages/gerenzhongxin.vue +++ b/ant-design-vue-jeecg/src/views/shopping/pages/gerenzhongxin.vue @@ -18,16 +18,16 @@ 发票管理 - Option 1 + 全部发票 - Option 2 + 已开发票 - Option 3 + 待开发票 - Option 4 + 抬头管理 @@ -122,6 +122,37 @@ --> + + +
+ +
+
+ {{item.date}} + 已开票 + 待开票 +
+
+
+ +
+
+
订单编号:{{item.orderNum}}
+
发票类型:{{item.type}}
+
发票内容:{{item.content}}
+
发票抬头:{{item.title}}
+
开票金额:{{item.price}}
+
+
+
申请换开
+
查看详情
+
+
+
+ +
+ +
@@ -168,16 +199,17 @@ import { getFileAccessHttpUrl} from "@/api/manage" import { httpAction, getAction } from '@/api/manage' import PasswordModal from '../../system/modules/PasswordModal' + import Collection from "../components/collection"; + import AddrView from "../components/addrView" export default { name: "gerenzhongxin", - components: { Header,Footer,PasswordModal }, - data() {0 + components: { Header,Footer,PasswordModal ,Collection,AddrView}, + data() { return { model:{ username1: "" }, - - current: ['allorders'],//目前打开的菜单 + current: ['invoice1'],//目前打开的菜单 key:'',//当前选择的订单状态(待支付、待收货等) allOrders2:[], allOrders1:[ @@ -225,7 +257,42 @@ } ],//所有订单,包括未支付、未收获等 allOrders:[],//目前展示的订单 - + invoiceList:[],//目前展示的发票列表 + invoiceList1:[ + { + id:1, + date:'2022-08-19 14:09:13', + billing:true,//是否已开票 + imgUrl:require("../assets/cloth001.png"), + orderNum:1237943879,//订单编号 + type:"1",//为1为普通发票 + content:"商品明细",//发票内容 + title:"易创网络科技有限公司",//抬头 + price:2456,//价格 + }, + { + id:2, + date:'2022-08-20 14:09:13', + billing:false,//是否已开票 + imgUrl:require("../assets/cloth002.png"), + orderNum:1237943880,//订单编号 + type:"1",//为1为普通发票 + content:"商品明细",//发票内容 + title:"易创网络科技有限公司",//抬头 + price:2456,//价格 + }, + { + id:3, + date:'2022-08-30 14:09:13', + billing:true,//是否已开票 + imgUrl:require("../assets/cloth003.png"), + orderNum:1237943881,//订单编号 + type:"1",//为1为普通发票 + content:"商品明细",//发票内容 + title:"易创网络科技有限公司",//抬头 + price:2456,//价格 + }, + ],//全部发票数据 url: { list: "/starehouse/starehouse/list", @@ -416,9 +483,18 @@ else if(key.key == 'yiwancheng'){ /*this.allOrders = this.allOrders1.filter(item=>item.receipt == true)*/ this.allOrders = this.allOrders2.filter(item=>item.receipt == true) - }else{ - this.allOrders=[] + }else if(key.key == 'invoice1'){//选择全部发票选项 + this.invoiceList = this.invoiceList1 + } + else if(key.key == 'invoice2'){//选择已开发票选项 + this.invoiceList = this.invoiceList1.filter(item=>item.billing == true) + } + else if(key.key == 'invoice3'){//选择未开发票选项 + this.invoiceList = this.invoiceList1.filter(item=>item.billing == false) } + // else{ + // this.allOrders=[] + // } } }, }; @@ -434,6 +510,18 @@ line-height: 40px; transition: all 0.2s; } + .default { + border: 2px solid #1b1b1b; + color: #1b1b1b; + margin-right: 20px; + + &:hover { + border: 2px solid #1b1b1b; + color: #fff; + opacity: 0.8; + background-color: #1b1b1b; + } + } .primary { background: #1b1b1b; border: 2px solid #1b1b1b; @@ -443,6 +531,15 @@ } } } +.font_01{ + color: #333; + font-size: 16px; + font-weight: 500; +} + .font_02{ + color: #333; + font-size: 16px; + } .bg{ width: 100%; height: 250px; @@ -470,6 +567,52 @@ /deep/ .ant-menu{ display: flex; justify-content: space-between; + } + .invoiceList{ + padding-left: 20px; + padding-right: 20px; + width: 1114px;margin:0 auto; + .d-flex{ + justify-content: space-between; + } + .invoice{ + padding-top: 40px; + padding-bottom: 20px; + border-bottom: 1px solid #DADADA; + .title{ + margin-bottom: 25px; + } + .img{ + width: 232px; + height: 232px; + img{ + width: 232px; + height: 232px; + } + } + .invoiceInfo{ + width: 483px; + .font_01{ + margin-bottom: 26px; + } + .font_02{ + margin-bottom: 12px; + } + } + .btnDiv{ + width: 145px; + flex-direction: column; + justify-content: flex-end; + padding-bottom: 26px; + .dialogButton{ + width: 100%; + margin-bottom: 17px; + } + } + } + + + } .orderList{ /*margin-top: 60px;*/ diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerreceivingaddress/mapper/CustomerReceivingAddressMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerreceivingaddress/mapper/CustomerReceivingAddressMapper.java index 27ef59ec..bf38c920 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerreceivingaddress/mapper/CustomerReceivingAddressMapper.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerreceivingaddress/mapper/CustomerReceivingAddressMapper.java @@ -31,5 +31,24 @@ public interface CustomerReceivingAddressMapper extends BaseMapper getcra(String userid); + @Select("select * from customer_receiving_address where user_id =#{userid} and sort ='0'") + CustomerReceivingAddress getneed(String userid); + + @Update("update customer_receiving_address set sort ='0' where id = #{id} ") + void updatesetneed(String id); + + @Update("update customer_receiving_address set sort =#{sort} where id = #{id} ") + void updatec(String id, Integer sort); + + @Update("update customer_receiving_address set sort ='0' where id = #{id} ") + void updates(String id); + + @Select("SELECT * FROM customer_receiving_address WHERE create_by=#{username} ORDER BY sort DESC LIMIT 1") + CustomerReceivingAddress getcreatbuyuser(String username); + + @Select("select * from customer_receiving_address where create_by =#{username} and sort ='0'") + CustomerReceivingAddress getneedyls(String username); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerreceivingaddress/service/ICustomerReceivingAddressService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerreceivingaddress/service/ICustomerReceivingAddressService.java index c052b63b..7b28c6fc 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerreceivingaddress/service/ICustomerReceivingAddressService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerreceivingaddress/service/ICustomerReceivingAddressService.java @@ -3,6 +3,8 @@ package org.jeecg.modules.demo.customerreceivingaddress.service; import org.jeecg.modules.demo.customerreceivingaddress.entity.CustomerReceivingAddress; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + /** * @Description: 顾客地址表 * @Author: jeecg-boot @@ -16,4 +18,18 @@ public interface ICustomerReceivingAddressService extends IService getcra(String userid); + + CustomerReceivingAddress getneed(String userid); + + void updatesetneed(String id); + + void updatec(String id, Integer sort); + + void updates(String id); + + CustomerReceivingAddress getcreatbuyuser(String username); + + CustomerReceivingAddress getneedyls(String username); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerreceivingaddress/service/impl/CustomerReceivingAddressServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerreceivingaddress/service/impl/CustomerReceivingAddressServiceImpl.java index 05d7ca61..e18fc5ac 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerreceivingaddress/service/impl/CustomerReceivingAddressServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerreceivingaddress/service/impl/CustomerReceivingAddressServiceImpl.java @@ -8,6 +8,8 @@ import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import java.util.List; + /** * @Description: 顾客地址表 * @Author: jeecg-boot @@ -51,4 +53,39 @@ public class CustomerReceivingAddressServiceImpl extends ServiceImpl getcra(String userid) { + return customerReceivingAddressMapper.getcra(userid); + } + + @Override + public CustomerReceivingAddress getneed(String userid) { + return customerReceivingAddressMapper.getneed(userid); + } + + @Override + public void updatesetneed(String id) { + customerReceivingAddressMapper.updatesetneed(id); + } + + @Override + public void updatec(String id, Integer sort) { + customerReceivingAddressMapper.updatec(id,sort); + } + + @Override + public void updates(String id) { + customerReceivingAddressMapper.updates(id); + } + + @Override + public CustomerReceivingAddress getcreatbuyuser(String username) { + return customerReceivingAddressMapper.getcreatbuyuser(username); + } + + @Override + public CustomerReceivingAddress getneedyls(String username) { + return customerReceivingAddressMapper.getneedyls(username); + } } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyProductPlanAutoController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyProductPlanAutoController.java index 134e8e83..092fa021 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyProductPlanAutoController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyProductPlanAutoController.java @@ -30,6 +30,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Arrays; +import java.util.List; /** * @Description: 生产计划自动化 @@ -46,10 +47,17 @@ public class ZyProductPlanAutoController extends JeecgController productPlanAuto4Mock(List workOrderIds) { + iZyProductPlanAutoService.doAuto(workOrderIds); + return Result.OK(); + } + @ApiOperation(value = "生产计划自动化", notes = "生产计划自动化") - @GetMapping(value = "/auto") - public Result auto(HttpServletRequest req) { - iZyProductPlanAutoService.doAuto(req); + @GetMapping(value = "/productPlanAuto") + public Result productPlanAuto() { + iZyProductPlanAutoService.doAuto(null); return Result.OK(); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyProductPlanAutoService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyProductPlanAutoService.java index d68eb088..d8963946 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyProductPlanAutoService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyProductPlanAutoService.java @@ -3,8 +3,10 @@ package org.jeecg.modules.productplan.service; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.productplan.entity.ZyProductPlan; import org.jeecg.modules.productplan.entity.vo.PaiWeiTuVo; +import org.jeecg.modules.workorder.entity.WorkOrder; import javax.servlet.http.HttpServletRequest; +import java.util.List; /** * @Description: 生产计划 @@ -14,7 +16,7 @@ import javax.servlet.http.HttpServletRequest; */ public interface IZyProductPlanAutoService extends IService { - void doAuto(HttpServletRequest req); + void doAuto(List workOrderList); boolean filling4Auto(String planId); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/IZyProductPlanAutoServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/IZyProductPlanAutoServiceImpl.java index 56cf578c..a854b4f2 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/IZyProductPlanAutoServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/IZyProductPlanAutoServiceImpl.java @@ -37,6 +37,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.ObjectUtils; import javax.servlet.http.HttpServletRequest; +import java.time.LocalDateTime; import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; @@ -89,8 +90,7 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl saveProductPlan(List workOrderList) { if (ObjectUtils.isEmpty(workOrderList)) return Collections.EMPTY_LIST; @@ -109,8 +109,14 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl productPlanList = iZyProductPlanService.list(new LambdaQueryWrapper() + .eq(ZyProductPlan::getStatus, ProductPlanStatusEnum.UNAUDITED.getCode()) + .in(ZyProductPlan::getStatus, zyProductPlanProductCodes)); + return productPlanList; + } + + /** + * 模拟测试方法 + * + * @param workOrderList + * @return + */ + @Transactional(rollbackFor = Exception.class, readOnly = false) + List saveProductPlan4Mock(List workOrderList) { + if (ObjectUtils.isEmpty(workOrderList)) return Collections.EMPTY_LIST; + + Set zyProductPlanProductCodes = new LinkedHashSet<>(); + /** + * 模拟测试 车间、负责人、班组、组长使用固定值 + */ + + workOrderList.stream().forEach(e -> { + String productCode = e.getProductCode(); + ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper() + .eq(ZyProduct::getWorkOrderId, productCode)); + Optional.ofNullable(zyProduct).orElseThrow(() -> new JeecgBootException(productCode + ":产品不存在")); + + //2,保存生产计划 + ZyProductPlan zyProductPlan = new ZyProductPlan(); + zyProductPlan.setProductCode(productCode); + zyProductPlan.setProductNo(zyProduct.getProductCode()); + zyProductPlan.setProductName(zyProduct.getProductName()); + + if (StringUtils.isNotBlank(zyProduct.getEnterprisesId())) { + SysDepart sysDepart = iSysDepartService.getById(zyProduct.getEnterprisesId()); + //生产企业 + zyProductPlan.setProductOrg(StringUtils.isNotBlank(sysDepart.getDepartName()) ? sysDepart.getDepartName() : ""); + } + //生产时长,取zy_product表生产时间 + zyProductPlan.setDuration(zyProduct.getProduceTime()); + + SysDepart sysDepart = iSysDepartService.getOne(new LambdaQueryWrapper() + .eq(SysDepart::getOrgCategory, "2") + .eq(SysDepart::getDepartName, "测试生产企业")); + if (ObjectUtils.isEmpty(sysDepart)) throw new JeecgBootException("生产计划自动化-mock-[企业信息]数据异常!"); + + //车间 + zyProductPlan.setWorkshopId(sysDepart.getId()); + List sysDepartIds = new LinkedList<>(); + sysDepartIds.add(sysDepart.getId()); + List sysUserList = iSysUserService.getUserByDepIds(sysDepartIds, null); + //车间负责人 + zyProductPlan.setResponsiblePerson(sysUserList.get(0).getUsername()); + Groupx groupx = iGroupxService.getOne(new LambdaQueryWrapper().eq(Groupx::getDepartId, sysDepart.getId()).eq(Groupx::getGroupName, "测试班组")); + if (ObjectUtils.isEmpty(groupx)) throw new JeecgBootException("生产计划自动化-mock-[班组]数据异常!"); + //班组 + zyProductPlan.setTeamId(groupx.getId()); + //班长 + SysUser sysUser = iSysUserService.getById(groupx.getEnterprisesManager()); + zyProductPlan.setTeamLeader(sysUser.getUsername()); + Date date = new Date(); + //开始时间 + zyProductPlan.setWorkTime(date); + //审核人 + zyProductPlan.setAuditBy("admin"); + //审核时间 + zyProductPlan.setAuditTimr(date); + //生产计划状态为未审核 zyProductPlan.setStatus(new Integer(ProductPlanStatusEnum.UNAUDITED.getCode())); + //保存生产计划 iZyProductPlanService.save(zyProductPlan); + //更新work_order表work_order_status为“1” (不能为其新增生产计划) iWorkOrderService.lambdaUpdate().set(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.REVIEWED.getCode()).update(); zyProductPlanProductCodes.add(productCode); }); + //根据productCode,查询本次创建生产计划 List productPlanList = iZyProductPlanService.list(new LambdaQueryWrapper() .eq(ZyProductPlan::getStatus, ProductPlanStatusEnum.UNAUDITED.getCode()) @@ -162,50 +257,28 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl sysDepartList2 = new LinkedList<>(); - sysDepartList2.addAll(list2); - int size2 = sysDepartList2.size(); - - while (size2 < size) { - sysDepartList2.addAll(list2); - size2 = sysDepartList2.size(); - } - - System.out.println("sysDepartList2 = " + sysDepartList2.size()); - System.out.println("list2 = " + list2.size()); - System.out.println("list = " + list.size()); - - } - @Override - public void doAuto(HttpServletRequest req) { + @Transactional(rollbackFor = Exception.class, readOnly = false) + public void doAuto(List workOrderList4Mock) { //1,获取未排产工单 - List workOrderList = iWorkOrderService.list(new LambdaQueryWrapper() - .eq(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.UNAUDITED.getCode())); + List workOrderList; + if (ObjectUtils.isEmpty(workOrderList4Mock)) { + workOrderList = iWorkOrderService.list(new LambdaQueryWrapper() + .eq(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.UNAUDITED.getCode())); + } else { + workOrderList = iWorkOrderService.list(new LambdaQueryWrapper() + .eq(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.UNAUDITED.getCode()) + .in(WorkOrder::getId, workOrderList4Mock)); + } + +// List workOrderList = iWorkOrderService.list(new LambdaQueryWrapper() +// .eq(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.UNAUDITED.getCode())); + if (ObjectUtils.isEmpty(workOrderList)) return; //2,保存生产计划 - List productPlanList = this.saveProductPlan(workOrderList); +// List productPlanList = this.saveProductPlan(workOrderList); + List productPlanList = this.saveProductPlan4Mock(workOrderList); if (ObjectUtils.isEmpty(productPlanList)) return; //3,同步计划生产工序、同步生产计划工序面料、同步生产计划辅料 @@ -219,21 +292,24 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl { + //TODO 数据不完整,测试时注释 // boolean b = this.filling4Auto(k.getId()); // if (b) { - List planProcessList = zyPlanProcessService.list(new LambdaQueryWrapper().eq(ZyPlanProcess::getPlanId, k.getId())); - Optional.ofNullable(planProcessList).orElse(new LinkedList<>()).forEach(e -> { - // 5,生成物料单 - zyPlanProcessService.createMaterialBill(e); - // 5,发送到仓库 - zyPlanProcessService.sendToRepository(e); - }); + List planProcessList = zyPlanProcessService.list(new LambdaQueryWrapper().eq(ZyPlanProcess::getPlanId, k.getId())); + Optional.ofNullable(planProcessList).orElse(new LinkedList<>()).forEach(e -> { + // 5,生成物料单 + zyPlanProcessService.createMaterialBill(e); + // 5,发送到仓库 + zyPlanProcessService.sendToRepository(e); + }); // } }); } /** + * 匹配设备&工具&工人 + *

* 匹配车间工位设备与工序设备,工位设备包含工序设备即匹配成功,匹配失败做异常处理 * 匹配车间工位工具与工序设备,工位设备包含工序设备即匹配成功,匹配失败做异常处理 * @@ -265,8 +341,9 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl planProcessList2 = zyPlanProcessService.list(new LambdaQueryWrapper().eq(ZyPlanProcess::getPlanId, planId)); //匹配工人 - this.diffWorker(planProcessList, planId); + this.diffWorker(planProcessList2, planId); return true; } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/ApeopersionController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/ApeopersionController.java index cce126b6..a548bbe2 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/ApeopersionController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/ApeopersionController.java @@ -3,24 +3,37 @@ package org.jeecg.modules.system.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.google.common.base.Joiner; +import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; import org.aspectj.apache.bcel.generic.RET; import org.jeecg.common.api.vo.Result; +import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.base.service.BaseCommonService; +import org.jeecg.modules.demo.customercollectgoods.entity.Customercollectgoods; +import org.jeecg.modules.demo.customercollectgoods.service.ICustomercollectgoodsService; +import org.jeecg.modules.demo.customerreceivingaddress.entity.CustomerReceivingAddress; +import org.jeecg.modules.demo.customerreceivingaddress.service.ICustomerReceivingAddressService; +import org.jeecg.modules.demo.customershoppingcart.entity.CustomerShoppingCart; +import org.jeecg.modules.demo.customershoppingcart.service.ICustomerShoppingCartService; +import org.jeecg.modules.demo.zygoods.entity.ZyGoods; +import org.jeecg.modules.demo.zygoods.service.IZyGoodsService; import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.service.ISysUserService; +import org.jeecg.modules.system.vo.Grzx1; +import org.jeecg.modules.system.vo.Grzx2; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpRequest; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.lang.reflect.Field; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; /* 这个是个人中心专用控制器,之前全都写在SysUserController(用户控制器里面,感觉不妥)因此就专门拖出来一个 @@ -34,6 +47,18 @@ public class ApeopersionController { @Autowired private ISysUserService sysUserService; + @Autowired + private ICustomercollectgoodsService customercollectgoodsService; + + @Autowired + private IZyGoodsService zyGoodsService; + + @Autowired + private ICustomerShoppingCartService customerShoppingCartService; + + @Autowired + private ICustomerReceivingAddressService customerReceivingAddressService; + /* 个人中心,我的账户的数据获取 @@ -44,15 +69,15 @@ public class ApeopersionController { String id = loginUser.getId(); SysUser syu = new SysUser(); syu = sysUserService.getneeduser(id); + findgoods(); return Result.ok(syu); } - +//个人中心的我的账户页面需要的数据 @RequestMapping(value = "/updateneeduser", method = RequestMethod.GET) public Result updateneeduser(@RequestParam(name = "form", required = true) String form) { Map map = JSON.parseObject(form,Map.class); - System.out.println(map); String id = (String) map.get("id"); String sex= map.get("sex").toString(); String birthday= (String) map.get("birthday"); @@ -60,6 +85,215 @@ public class ApeopersionController { String phone= (String) map.get("phone"); String email= (String) map.get("email"); sysUserService.updateneed(id,sex,birthday,realname,phone,email); + return Result.ok("success"); } + + //个人中心的我的收藏的首页需要的数据 + @RequestMapping(value = "/findallcg", method = RequestMethod.GET) + public Result findgoods() { + //获取当前登人的信息 + LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userid = loginUser.getUsername(); + List g3 = new ArrayList<>(); + //根据当前登的人获取收藏夹里面的搜藏的商品的名称及其款式 + g3 = sysUserService.getscgoods(userid); + //获取的是辅料 + List s1 =new ArrayList<>(); + //获取的是面料 + List s2 =new ArrayList<>(); + //把获取的商品信息导入到新的list里面 + for (int i=0;i findgoods(@RequestParam(name = "id", required = true) String id) { + //这里方便获取当前登陆信息 + LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + //这里获取当前登陆的id + String userid = loginUser.getId(); + //这里获取当前登陆的真实姓名 + String rlname = loginUser.getRealname(); + //这个是根据goodid查询收藏的场频的信息 + Customercollectgoods ccs = customercollectgoodsService.getById(id); + String goodid= ccs.getGoodsId(); + //根据goodid查询goods的对象 + ZyGoods zyd =zyGoodsService.getById(goodid); + //初始化购物车对象 + CustomerShoppingCart cst =new CustomerShoppingCart(); + //开始组装购物车对象 + cst.setUserId(userid); + cst.setUsername(rlname); + cst.setGoodsId(zyd.getId()); + cst.setGoodsname(zyd.getGoodsName()); + cst.setNumber(1); + cst.setPrice(zyd.getPromotionPrice()); + cst.setZj(zyd.getPromotionPrice() * 1); + cst.setPlaceorigin(zyd.getPlaceOrigin()); + cst.setGoodimg(zyd.getDefaultPicture()); + cst.setStyleId(zyd.getStyleId()); + customerShoppingCartService.save(cst); + return Result.ok("添加完成"); + } + + //个人中心的我的收藏的首页需要的数据 + @RequestMapping(value = "/delteys", method = RequestMethod.GET) + public Result delteys(@RequestParam(name = "id", required = true) String id) { + customercollectgoodsService.removeById(id); + return Result.ok("添加完成"); + } + + + //个人中心的收货地址的首页需要的数据 + @RequestMapping(value = "/getaddress", method = RequestMethod.GET) + public Result getaddress() { + //这里方便获取当前登陆信息 + LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + //这里获取当前登陆的id + String userid = loginUser.getId(); + Integer usersex = loginUser.getSex(); + //这个是根据用户id查收货地址 + List cra =customerReceivingAddressService.getcra(userid); + for (int i=0;i deleteadd(@RequestParam(name="id",required=true) String id) { + customerReceivingAddressService.removeById(id); + return Result.OK("删除成功!"); + } + + + + @RequestMapping(value = "/getaddressbyid", method = RequestMethod.GET) + public Result getaddressbyid(@RequestParam(name="id",required=true) String id) { + System.out.println(id); + /*return Result.ok("");*/ + + return null; + } + + //这个功能是个人中心的地址管设置默认地址 + @RequestMapping(value = "/sdqx", method = RequestMethod.GET) + public Result sdqx(@RequestParam(name="id",required=true) String id) { + //根据id查询需要设置成默认收货地址的收货地址 + CustomerReceivingAddress cus = customerReceivingAddressService.getById(id); + String userid = cus.getUserId(); + Integer sort = cus.getSort(); + //开始寻找之前的默认地址 + CustomerReceivingAddress cusm = customerReceivingAddressService.getneed(userid); + //如果没有默认地址 + if (cusm==null){ + customerReceivingAddressService.updatesetneed(id); + }else{ + //这个是更新默认地址 + customerReceivingAddressService.updatec(cusm.getId(),sort); + customerReceivingAddressService.updates(id); + } + return Result.OK("成功!"); + } + + //这个功能是个人中心的地址添加收货地址,不是默认收货地址 + @RequestMapping(value = "/addadressress", method = RequestMethod.GET) + public Result addadressress(@RequestParam(name = "form", required = true) String form) { + System.out.println(form); + //这里方便获取当前登陆信息 + LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + //这里获取当前登陆的用户名 + String Username = loginUser.getUsername(); + //将前台传过来的json数据包转化成map + Map map = JSON.parseObject(form,Map.class); + //获取flag的数据 + String flag = map.get("flag").toString(); + //通过flag判断是否是需要的设置成默认地址 + if (flag.equals("false")){ + //寻找之前的排序的最后一个 + CustomerReceivingAddress cus = customerReceivingAddressService.getcreatbuyuser(Username); + CustomerReceivingAddress cus2 =new CustomerReceivingAddress(); + cus2.setUserId(loginUser.getId()); + cus2.setCityId((String)map.get("addr")); + cus2.setUsernamme((String)map.get("name")); + cus2.setAddress((String)map.get("detailed")); + cus2.setMobile((String)map.get("phone")); + cus2.setSort(cus.getSort()+1); + customerReceivingAddressService.save(cus2); + } else if (flag.equals("true")){ + //寻找之前的排序的最后一个 + CustomerReceivingAddress cus = customerReceivingAddressService.getcreatbuyuser(Username); + //开始寻找之前的默认地址 + CustomerReceivingAddress cusm = customerReceivingAddressService.getneedyls(Username); + //开始组装需要的新的默认地址 + CustomerReceivingAddress cus2 =new CustomerReceivingAddress(); + cus2.setUserId(loginUser.getId()); + cus2.setCityId((String)map.get("addr")); + cus2.setUsernamme((String)map.get("name")); + cus2.setAddress((String)map.get("detailed")); + cus2.setMobile((String)map.get("phone")); + cus2.setSort(0); + //将新的数据写入数据库 + customerReceivingAddressService.save(cus2); + //将老的默认收货地址放在排序的最后一个 + cusm.setSort(cus.getSort()+1); + customerReceivingAddressService.updateById(cusm); + } + + return Result.OK("成功!"); + } + + + + + //这个功能是个人中心的地址添加收货地址,不是默认收货地址 + @RequestMapping(value = "/updateadressress", method = RequestMethod.GET) + public Result updateadressress(@RequestParam(name = "form", required = true) String form) { + //将前台传过来的json数据包转化成map + Map map = JSON.parseObject(form,Map.class); + //查询需要的对象 + CustomerReceivingAddress needc = customerReceivingAddressService.getById((String)map.get("id")); + needc.setMobile((String)map.get("phone")); + needc.setUsernamme((String)map.get("name")); + needc.setAddress((String)map.get("detailed")); + needc.setCityId((String)map.get("addr")); + customerReceivingAddressService.updateById(needc); + return Result.OK("成功!"); + } + + + + } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysUserMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysUserMapper.java index ea734259..bca8cea8 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysUserMapper.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysUserMapper.java @@ -178,4 +178,12 @@ public interface SysUserMapper extends BaseMapper { //个人中心我的账户修改个人信息 @Update("UPDATE sys_user SET realname = #{realname},sex=#{sex},birthday=#{birthday},phone=#{phone},email=#{email} WHERE id = #{id} ") void updateneed(String id, String sex, String birthday, String realname, String phone, String email); + + List getscgoods(String userid); + + @Select("SELECT zf.name FROM customercollectgoods AS crg LEFT JOIN goods_fabric AS gf ON crg.goods_id = gf.goods_id LEFT JOIN zy_fabric AS zf ON gf.fabric_id = zf.id WHERE crg.id=#{id}") + List getscgoodml(String id); + + @Select("SELECT za.contents FROM customercollectgoods AS crg LEFT JOIN goods_accessories AS ga ON crg.goods_id = ga.goods_id LEFT JOIN zy_accessories AS za ON ga.accessories_id = za.id where crg.id=#{id}") + List getscgoodfi(String id); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserMapper.xml b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserMapper.xml index fb4af157..933fa6d0 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserMapper.xml +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserMapper.xml @@ -198,4 +198,14 @@ WHERE og.id=#{id} + + + + + diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysUserService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysUserService.java index ff1d60e5..e7e12a85 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysUserService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysUserService.java @@ -272,4 +272,11 @@ public interface ISysUserService extends IService { SysUser getneeduser(String id); void updateneed(String id, String sex, String birthday, String realname, String phone, String email); + + //此处用于个人中心获取收藏商品的信息 + List getscgoods(String userid); + //此处用于个人中心获取收藏商品的面料 + List getscgoodml(String id); + //此处用于个人中心获取收藏商品的辅料 + List getscgoodfi(String id); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java index 3d1f8dcd..095598c2 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java @@ -23,6 +23,7 @@ import org.jeecg.modules.system.model.SysUserSysDepartModel; import org.jeecg.modules.system.service.ISysUserService; import org.jeecg.modules.system.vo.Grzx1; import org.jeecg.modules.system.vo.Grzx2; + import org.jeecg.modules.system.vo.SysUserDepVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; @@ -588,4 +589,19 @@ public class SysUserServiceImpl extends ServiceImpl impl userMapper.updateneed(id,sex,birthday,realname,phone,email); } + @Override + public List getscgoods(String userid) { + return userMapper.getscgoods(userid); + } + + @Override + public List getscgoodml(String id) { + return userMapper.getscgoodml(id); + } + + @Override + public List getscgoodfi(String id) { + return userMapper.getscgoodfi(id); + } + }