|  |  |  | 
|---|
|  |  |  | import com.matrix.system.common.tools.ResponseHeadUtil; | 
|---|
|  |  |  | import com.matrix.system.hive.action.util.QueryUtil; | 
|---|
|  |  |  | import com.matrix.system.hive.bean.AchieveNew; | 
|---|
|  |  |  | import com.matrix.system.hive.dao.AchieveNewDao; | 
|---|
|  |  |  | import com.matrix.system.hive.plugin.util.CollectionUtils; | 
|---|
|  |  |  | import com.matrix.system.hive.service.AchieveNewService; | 
|---|
|  |  |  | import com.matrix.system.hive.service.SysOrderItemService; | 
|---|
|  |  |  | import com.matrix.system.hive.service.SysOrderService; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Controller; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.ui.ModelMap; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestBody; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private AchieveNewService achieveNewService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SysOrderService sysOrderService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SysOrderItemService sysOrderItemService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private AchieveNewDao achieveNewDao; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 门店每日单据明细表 | 
|---|
|  |  |  | 
|---|
|  |  |  | String title = "每日单据明细"; | 
|---|
|  |  |  | orderSheet.setSheetName(title); | 
|---|
|  |  |  | orderSheet.setTitle(title); | 
|---|
|  |  |  | String[] header = {"年", "月", "日",   "订单类型", "订单编号", "会员级别", "姓名", "项目名称", "总金额", "卡项", "现金单次", "现金产品", "划扣", "本金消耗", "赠消", "提成", "顾问", "美疗师", "人头", "项目个数", "项目时间", "门店"}; | 
|---|
|  |  |  | String[] header = {"年", "月", "日", "订单编号", "订单类型", "会员姓名", "项目名称", "订单金额", "订单业绩", "收款方式", "业绩类型", "员工", "本金消耗", "赠消", "提成", "人头", "项目个数", "项目时间", "顾问", "门店"}; | 
|---|
|  |  |  | orderSheet.setHeaders(header); | 
|---|
|  |  |  | SysUsers sysUsers = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); | 
|---|
|  |  |  | if(!AppConstance.ZONGDIAN.equals(sysUsers.getShopName())){ | 
|---|
|  |  |  | 
|---|
|  |  |  | temp.add(item.getYear()); | 
|---|
|  |  |  | temp.add(item.getMonth()); | 
|---|
|  |  |  | temp.add(item.getDay()); | 
|---|
|  |  |  | temp.add(item.getOrderType()); | 
|---|
|  |  |  | temp.add(item.getOrderNo()); | 
|---|
|  |  |  | temp.add(item.getLevelName()); | 
|---|
|  |  |  | temp.add(item.getOrderType()); | 
|---|
|  |  |  | temp.add(item.getVipName()); | 
|---|
|  |  |  | temp.add(item.getProName()); | 
|---|
|  |  |  | temp.add(item.getZkTotal()); | 
|---|
|  |  |  | temp.add(item.getCardCash()); | 
|---|
|  |  |  | temp.add(item.getProjCash()); | 
|---|
|  |  |  | temp.add(item.getGoodsCash()); | 
|---|
|  |  |  | temp.add(item.getConsume()); | 
|---|
|  |  |  | temp.add(item.getPayMethod()); | 
|---|
|  |  |  | temp.add(item.getMeiliao()); | 
|---|
|  |  |  | temp.add(item.getHisConsume()); | 
|---|
|  |  |  | temp.add(item.getFreeConsume()); | 
|---|
|  |  |  | temp.add(item.getProjPercentage()); | 
|---|
|  |  |  | temp.add(item.getGuwen()); | 
|---|
|  |  |  | temp.add(item.getMeiliao()); | 
|---|
|  |  |  | temp.add(item.getNumberOfPeople()); | 
|---|
|  |  |  | temp.add(item.getProjNum()); | 
|---|
|  |  |  | temp.add(item.getProjTime()); | 
|---|
|  |  |  | temp.add(item.getGuwen()); | 
|---|
|  |  |  | temp.add(item.getShopName()); | 
|---|
|  |  |  | list.add(temp); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | public AjaxResult del(Long id) { | 
|---|
|  |  |  | int i = achieveNewService.removeById(id); | 
|---|
|  |  |  | if (i > 0) { | 
|---|
|  |  |  | return AjaxResult.buildSuccessInstance("删除失败"); | 
|---|
|  |  |  | return AjaxResult.buildSuccessInstance("删除成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return AjaxResult.buildFailInstance("删除失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/add") | 
|---|
|  |  |  | @ResponseBody | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | public AjaxResult add(@RequestBody List<AchieveNew> list) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return AjaxResult.buildSuccessInstance("添加成功"); | 
|---|
|  |  |  | if (CollectionUtils.isNotEmpty(list)) { | 
|---|
|  |  |  | //删除原业绩 | 
|---|
|  |  |  | achieveNewDao.deleteByOrderId(list.get(0).getOrderId()); | 
|---|
|  |  |  | //插入新业绩 | 
|---|
|  |  |  | achieveNewDao.batchInsert(list); | 
|---|
|  |  |  | return AjaxResult.buildSuccessInstance("保存成功"); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return AjaxResult.buildFailInstance("未找到业绩数据"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|